Struct map::nodes::Node

source ·
pub struct Node<T: MapState> {
    pub position: Position,
    pub adjacent_nodes: RefCell<AdjacentNodes<T>>,
    pub status: RefCell<NodeStatus<T>>,
}

Fields§

§position: Position§adjacent_nodes: RefCell<AdjacentNodes<T>>§status: RefCell<NodeStatus<T>>

Implementations§

source§

impl Node<MapStateUninitialized>

source

pub fn new(position: Position) -> Self

source

pub fn set_train(&self, train: UnIntiTrainRef) -> Result<()>

The nodes can be of two types:

  • switch nodes
  • non-switch nodes when a link is added it must follow a few rules:
  • a non-switch node can have at most one link forward
  • a non-switch node can have at most one link backward
  • a switch node must have exactly two links forward, (one for each switch position)
  • a switch node can have at most one link backward this function enforce all those rules, except the third one, which is enforced inside map_creation_view
source

pub fn get_next_available_direction(&self) -> Result<Direction>

Trait Implementations§

source§

impl<T: Clone + MapState> Clone for Node<T>

source§

fn clone(&self) -> Node<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CompleteInitialization for Node<MapStateInitialized>

source§

impl<T: Debug + MapState> Debug for Node<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, T> Deserialize<'de> for Node<T>where T: Deserialize<'de> + MapState,

source§

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 Initialize for Node<MapStateUninitialized>

source§

impl Into<IntiNodeRef> for &Node<MapStateInitialized>

source§

fn into(self) -> IntiNodeRef

Converts this type into the (usually inferred) input type.
source§

impl<T: PartialEq + MapState> PartialEq<Node<T>> for Node<T>

source§

fn eq(&self, other: &Node<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for Node<T>where T: Serialize + MapState,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl UnInitialize for Node<MapStateInitialized>

source§

impl<T: Eq + MapState> Eq for Node<T>

source§

impl<T: MapState> StructuralEq for Node<T>

source§

impl<T: MapState> StructuralPartialEq for Node<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Node<T>

§

impl<T> Send for Node<T>where <T as MapState>::NodeRefType: Send, <T as MapState>::SwitchRefType: Send, <T as MapState>::TrainRefType: Send,

§

impl<T> !Sync for Node<T>

§

impl<T> Unpin for Node<T>where <T as MapState>::NodeRefType: Unpin, <T as MapState>::SwitchRefType: Unpin, <T as MapState>::TrainRefType: Unpin,

§

impl<T> UnwindSafe for Node<T>where <T as MapState>::NodeRefType: UnwindSafe, <T as MapState>::SwitchRefType: UnwindSafe, <T as MapState>::TrainRefType: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,