[][src]Struct stateright::Path

pub struct Path<State, Action>(_);

A path of states including actions. i.e. state --action--> state ... --action--> state.

You can convert to a Vec<_> with path.into_vec(). If you only need the actions, then use path.into_actions().

Implementations

impl<State, Action> Path<State, Action>[src]

pub fn from_actions<'a, M>(
    model: &M,
    init_state: State,
    actions: impl IntoIterator<Item = &'a Action>
) -> Option<Self> where
    M: Model<State = State, Action = Action>,
    State: PartialEq,
    Action: PartialEq + 'a, 
[src]

Constructs a path from a model, initial state, and a sequence of actions. Panics for inputs unreachable via the model.

pub fn last_state(&self) -> &State[src]

Extracts the last state.

pub fn into_actions(self) -> Vec<Action>[src]

Extracts the actions.

pub fn into_vec(self) -> Vec<(State, Option<Action>)>[src]

Convenience method for Into<Vec<_>>.

pub fn encode(&self) -> String where
    State: Hash
[src]

Encodes the path as a sequence of opaque "fingerprints" delimited by forward slash (/) characters.

Trait Implementations

impl<State: Clone, Action: Clone> Clone for Path<State, Action>[src]

impl<State: Debug, Action: Debug> Debug for Path<State, Action>[src]

impl<State, Action> Into<Vec<(State, Option<Action>), Global>> for Path<State, Action>[src]

impl<State: PartialEq, Action: PartialEq> PartialEq<Path<State, Action>> for Path<State, Action>[src]

impl<State, Action> StructuralPartialEq for Path<State, Action>[src]

Auto Trait Implementations

impl<State, Action> RefUnwindSafe for Path<State, Action> where
    Action: RefUnwindSafe,
    State: RefUnwindSafe

impl<State, Action> Send for Path<State, Action> where
    Action: Send,
    State: Send

impl<State, Action> Sync for Path<State, Action> where
    Action: Sync,
    State: Sync

impl<State, Action> Unpin for Path<State, Action> where
    Action: Unpin,
    State: Unpin

impl<State, Action> UnwindSafe for Path<State, Action> where
    Action: UnwindSafe,
    State: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,