Skip to main content

TopNode

Struct TopNode 

Source
pub struct TopNode<T, U, V, W>
where T: StateEnum, U: StateMachineEvent, V: TopState<State = T, Event = U>, W: SubstateEnum<T, U, V>,
{ pub node: Node<T, U, V, W>, /* private fields */ }
Expand description

The root node of a state tree.

Fields§

§node: Node<T, U, V, W>

Implementations§

Source§

impl<T, U, V, W> TopNode<T, U, V, W>
where T: StateEnum, U: StateMachineEvent, V: TopState<State = T, Event = U>, W: SubstateEnum<T, U, V>,

Source

pub fn new(top_state: V, name: String) -> Self

Available on crate feature std only.

Make a new TopNode from a TopState and a machine name.

Source

pub fn init(&mut self)

Perform the initial transition of this node.

Source

pub fn update(&mut self)

Update this node and its active descendents.

Source

pub fn top_down_update(&mut self)

Top-down update this node and its active descendents.

Source

pub fn transition_quiet(&mut self, target: T, indent: bool, exact: bool)

Transition this node and its active descendents without logging the start and end of the transition.

Source

pub fn transition(&mut self, target: T, indent: bool, exact: bool)

Transition this node and its active descendents.

Source

pub fn state(&self) -> T

Get the current leaf state of this state tree.

Source

pub fn name(&self) -> &str

Get the name of this machine.

Source

pub fn set_name(&mut self, name: String)

Available on crate feature std only.

Set the name of this machine.

Source

pub fn state_matches(&self, state: T) -> bool

Does this node or any active descendents match a given state?

Source

pub fn handle_event(&mut self, event: &U)

Handle an event.

Auto Trait Implementations§

§

impl<T, U, V, W> Freeze for TopNode<T, U, V, W>
where V: Freeze, W: Freeze,

§

impl<T, U, V, W> RefUnwindSafe for TopNode<T, U, V, W>

§

impl<T, U, V, W> Send for TopNode<T, U, V, W>
where V: Send, W: Send, T: Send, U: Send,

§

impl<T, U, V, W> Sync for TopNode<T, U, V, W>
where V: Sync, W: Sync, T: Sync, U: Sync,

§

impl<T, U, V, W> Unpin for TopNode<T, U, V, W>
where V: Unpin, W: Unpin, T: Unpin, U: Unpin,

§

impl<T, U, V, W> UnsafeUnpin for TopNode<T, U, V, W>
where V: UnsafeUnpin, W: UnsafeUnpin,

§

impl<T, U, V, W> UnwindSafe for TopNode<T, U, V, W>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.