pub struct StateMachine<S: State> { /* private fields */ }Expand description
Generic state machine for validating transitions.
Implementations§
Source§impl<S: State + 'static> StateMachine<S>
impl<S: State + 'static> StateMachine<S>
pub fn new() -> Self
Sourcepub fn validate(
&self,
from: S,
to: S,
force: bool,
) -> Result<Transition<S>, TransitionError<S>>
pub fn validate( &self, from: S, to: S, force: bool, ) -> Result<Transition<S>, TransitionError<S>>
Validate a state transition.
Returns Ok(Transition) if valid, Err(TransitionError) if invalid.
If force is true, any transition is allowed (for admin overrides).
Trait Implementations§
Source§impl<S: Clone + State> Clone for StateMachine<S>
impl<S: Clone + State> Clone for StateMachine<S>
Source§fn clone(&self) -> StateMachine<S>
fn clone(&self) -> StateMachine<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<S> Freeze for StateMachine<S>
impl<S> RefUnwindSafe for StateMachine<S>where
S: RefUnwindSafe,
impl<S> Send for StateMachine<S>where
S: Send,
impl<S> Sync for StateMachine<S>where
S: Sync,
impl<S> Unpin for StateMachine<S>where
S: Unpin,
impl<S> UnwindSafe for StateMachine<S>where
S: 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