Struct stateright::Path
source · pub struct Path<State, Action>(_);
Expand description
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§
source§impl<State, Action> Path<State, Action>
impl<State, Action> Path<State, Action>
sourcepub 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,
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,
Constructs a path from a model, initial state, and a sequence of actions. Panics for inputs unreachable via the model.
sourcepub fn last_state(&self) -> &State
pub fn last_state(&self) -> &State
Extracts the last state.
sourcepub fn into_states(self) -> Vec<State>
pub fn into_states(self) -> Vec<State>
Extracts the states.
sourcepub fn into_actions(self) -> Vec<Action>
pub fn into_actions(self) -> Vec<Action>
Extracts the actions.
Trait Implementations§
source§impl<State: Ord, Action: Ord> Ord for Path<State, Action>
impl<State: Ord, Action: Ord> Ord for Path<State, Action>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<State: PartialEq, Action: PartialEq> PartialEq<Path<State, Action>> for Path<State, Action>
impl<State: PartialEq, Action: PartialEq> PartialEq<Path<State, Action>> for Path<State, Action>
source§impl<State: PartialOrd, Action: PartialOrd> PartialOrd<Path<State, Action>> for Path<State, Action>
impl<State: PartialOrd, Action: PartialOrd> PartialOrd<Path<State, Action>> for Path<State, Action>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<State: Eq, Action: Eq> Eq for Path<State, Action>
impl<State, Action> StructuralEq for Path<State, Action>
impl<State, Action> StructuralPartialEq for Path<State, Action>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more