pub struct StateMachine<S, C> { /* private fields */ }Expand description
Typed state machine with guarded transitions, audit, and persistence hooks.
Implementations§
Source§impl<S, C> StateMachine<S, C>
impl<S, C> StateMachine<S, C>
Sourcepub fn with_transition(self, transition: Transition<S, C>) -> Self
pub fn with_transition(self, transition: Transition<S, C>) -> Self
Register a transition.
Sourcepub fn with_persistence(
self,
persistence: Arc<dyn StatePersistence<S, C>>,
) -> Self
pub fn with_persistence( self, persistence: Arc<dyn StatePersistence<S, C>>, ) -> Self
Register a persistence hook.
Sourcepub fn snapshot(&self) -> StateSnapshot<S>
pub fn snapshot(&self) -> StateSnapshot<S>
Return the current snapshot.
Sourcepub fn audit_log(&self) -> Vec<AuditEntry<S, C>>
pub fn audit_log(&self) -> Vec<AuditEntry<S, C>>
Return a copy of the audit log.
Sourcepub fn apply(&self, name: &str, context: C) -> AppResult<StateSnapshot<S>>
pub fn apply(&self, name: &str, context: C) -> AppResult<StateSnapshot<S>>
Apply a named transition.
Auto Trait Implementations§
impl<S, C> !Freeze for StateMachine<S, C>
impl<S, C> !RefUnwindSafe for StateMachine<S, C>
impl<S, C> !UnwindSafe for StateMachine<S, C>
impl<S, C> Send for StateMachine<S, C>
impl<S, C> Sync for StateMachine<S, C>
impl<S, C> Unpin for StateMachine<S, C>
impl<S, C> UnsafeUnpin for StateMachine<S, C>where
S: UnsafeUnpin,
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