Skip to main content

StateMachine

Struct StateMachine 

Source
pub struct StateMachine<S, P1 = (), P2 = (), P3 = (), P4 = (), P5 = (), P6 = (), P7 = (), P8 = ()>
where S: State<P1, P2, P3, P4, P5, P6, P7, P8> + Machine<P1, P2, P3, P4, P5, P6, P7, P8> + StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S>,
{ /* private fields */ }

Implementations§

Source§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where S: State<P1, P2, P3, P4, P5, P6, P7, P8> + Machine<P1, P2, P3, P4, P5, P6, P7, P8> + StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S>,

Source

pub fn new_context<S2>( state: S2, context: S::Context, ) -> StateMachine<S::States, P1, P2, P3, P4, P5, P6, P7, P8>
where S2: StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S> + Into<S::States>,

Source

pub fn new<S2>(state: S2) -> Self
where S2: StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S> + Into<S::States>, S::Context: Default,

Source

pub fn run(&mut self)

Source

pub fn update(&mut self)

Source

pub fn transition(&mut self, new_state: impl Into<S>)

Source

pub fn context(&self) -> &S::Context

Source

pub fn context_mut(&mut self) -> &mut S::Context

Source

pub fn state(&self) -> &S::States

Source

pub fn state_mut(&mut self) -> &mut S::States

Trait Implementations§

Source§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> Debug for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where S: State<P1, P2, P3, P4, P5, P6, P7, P8> + Machine<P1, P2, P3, P4, P5, P6, P7, P8> + StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S>, S::States: Debug, S::Context: Debug,

Source§

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

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

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> Drop for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where S: State<P1, P2, P3, P4, P5, P6, P7, P8> + Machine<P1, P2, P3, P4, P5, P6, P7, P8> + StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> HasEndState for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where S: State<P1, P2, P3, P4, P5, P6, P7, P8> + Machine<P1, P2, P3, P4, P5, P6, P7, P8> + StateTypes<P1, P2, P3, P4, P5, P6, P7, P8, States = S> + HasEndState,

Auto Trait Implementations§

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> Freeze for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: Freeze, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: Freeze, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: Freeze,

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> RefUnwindSafe for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: RefUnwindSafe, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: RefUnwindSafe, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: RefUnwindSafe,

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> Send for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: Send, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: Send, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: Send,

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> Sync for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: Sync, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: Sync, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: Sync,

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> Unpin for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: Unpin, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: Unpin, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: Unpin,

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> UnsafeUnpin for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: UnsafeUnpin, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: UnsafeUnpin, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: UnsafeUnpin,

§

impl<S, P1, P2, P3, P4, P5, P6, P7, P8> UnwindSafe for StateMachine<S, P1, P2, P3, P4, P5, P6, P7, P8>
where <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::States: UnwindSafe, <S as StateTypes<P1, P2, P3, P4, P5, P6, P7, P8>>::Context: UnwindSafe, PhantomData<(P1, P2, P3, P4, P5, P6, P7, P8)>: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T, GFT> TupleSelect<T, GFT> for T

Source§

fn select<J>(&self) -> &J
where J: SelectFromTuple<T, GFT>,

Gets a reference to a tuple element defined by its type.
Your code will not compile if the tuple doesn’t have exactly 1 element of the chosen type.
Source§

impl<T, GFT> TupleSelectMut<T, GFT> for T

Source§

fn select_mut<J>(&mut self) -> &mut J
where J: SelectFromTupleMut<T, GFT>,

Gets a mutable reference to a tuple element defined by its type.
Your code will not compile if the tuple doesn’t have exactly 1 element of the chosen type.
Source§

impl<J> TupleTraitIter for J

Source§

fn iter_trait<U>(&self) -> impl Iterator<Item = &U>
where U: 'static + ?Sized, J: TupleAtTrait<U>,

Source§

impl<J> TupleTraitIterMut for J

Source§

fn iter_trait_mut<U>(&mut self) -> impl Iterator<Item = &mut U>
where U: 'static + ?Sized, J: TupleAtTraitMut<U>,