Struct SimpleStateImplementation

Source
pub struct SimpleStateImplementation<'a, K, Id, D, E>
where D: KeyProvidingData<K>, Id: Copy,
{ /* private fields */ }
Expand description

AutomatonState implementating struct which simplifies state definition by managing list of defined connections. Depends on data for providing next key. This key is then used to match a connection from the defined list. Each state has an assigned identifier which is used to inform which state did the automaton stop on. Identifier is copied to the result meaning it has to implement the Copy trait.

Implementations§

Source§

impl<'a, K, Id, D, E> SimpleStateImplementation<'a, K, Id, D, E>
where D: KeyProvidingData<K>, Id: Copy,

Source

pub fn new(id: Id) -> Self

Creates new simple state with provided identifier.

  • id - Identifier of this state which will be copied into result when automaton stops on this state.
Source

pub fn register_connection( &mut self, connection: SimpleInterStateConnection<'a, K, Id, D, E>, )

Adds connection to possible next states of current state.

Trait Implementations§

Source§

impl<'a, K, Id, D, E> AutomatonState<'a, Id, D, E> for SimpleStateImplementation<'a, K, Id, D, E>
where D: KeyProvidingData<K>, Id: Copy,

Source§

fn get_id_owned(&self) -> Id

Returns owned copy of identifier of this state.

Source§

fn get_id(&self) -> &Id

Returns identifier of this state.

Source§

fn execute_next_connection( &self, data: &mut D, ) -> Result<NextState<'a, Id, D, E>, E>

Finds connection by popping key from key iterator. Executes assigned function and returns next state if everything goes alright.

Auto Trait Implementations§

§

impl<'a, K, Id, D, E> Freeze for SimpleStateImplementation<'a, K, Id, D, E>
where Id: Freeze,

§

impl<'a, K, Id, D, E> !RefUnwindSafe for SimpleStateImplementation<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> !Send for SimpleStateImplementation<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> !Sync for SimpleStateImplementation<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> Unpin for SimpleStateImplementation<'a, K, Id, D, E>
where Id: Unpin, D: Unpin,

§

impl<'a, K, Id, D, E> !UnwindSafe for SimpleStateImplementation<'a, K, Id, D, E>

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.