Struct transit_grid::core::TransitNode
source · pub struct TransitNode<T> {
pub id: NodeId,
pub location: T,
}
Expand description
Structure representing a node in the transit network.
Each node has a unique identifier and a location.
The location type T
is generic and can be any type that implements the Copy
trait.
Examples
use geo::coord;
use transit_grid::core::TransitNode;
// GPS coordinates for London, UK: 51.5074 N, 0.1278 W
let node = TransitNode {
id: 1,
location: coord! { x: -0.1278, y: 51.5074 },
};
assert_eq!(node.id, 1);
assert_eq!(node.location, coord! { x: -0.1278, y: 51.5074 });
Fields§
§id: NodeId
A unique identifier for the node.
location: T
The location of the node, represented by a generic type T
.
Trait Implementations§
source§impl<T: Clone> Clone for TransitNode<T>
impl<T: Clone> Clone for TransitNode<T>
source§fn clone(&self) -> TransitNode<T>
fn clone(&self) -> TransitNode<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for TransitNode<T>
impl<T: Debug> Debug for TransitNode<T>
source§impl<'de, T> Deserialize<'de> for TransitNode<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for TransitNode<T>where T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: Hash> Hash for TransitNode<T>
impl<T: Hash> Hash for TransitNode<T>
source§impl<T: Ord> Ord for TransitNode<T>
impl<T: Ord> Ord for TransitNode<T>
source§fn cmp(&self, other: &TransitNode<T>) -> Ordering
fn cmp(&self, other: &TransitNode<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq<TransitNode<T>> for TransitNode<T>
impl<T: PartialEq> PartialEq<TransitNode<T>> for TransitNode<T>
source§fn eq(&self, other: &TransitNode<T>) -> bool
fn eq(&self, other: &TransitNode<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T: PartialOrd> PartialOrd<TransitNode<T>> for TransitNode<T>
impl<T: PartialOrd> PartialOrd<TransitNode<T>> for TransitNode<T>
source§fn partial_cmp(&self, other: &TransitNode<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &TransitNode<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T> Serialize for TransitNode<T>where
T: Serialize,
impl<T> Serialize for TransitNode<T>where T: Serialize,
impl<T: Copy> Copy for TransitNode<T>
impl<T: Eq> Eq for TransitNode<T>
impl<T> StructuralEq for TransitNode<T>
impl<T> StructuralPartialEq for TransitNode<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for TransitNode<T>where T: RefUnwindSafe,
impl<T> Send for TransitNode<T>where T: Send,
impl<T> Sync for TransitNode<T>where T: Sync,
impl<T> Unpin for TransitNode<T>where T: Unpin,
impl<T> UnwindSafe for TransitNode<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.