pub struct StateMachineV2 { /* private fields */ }Expand description
A finite state machine with named states and transitions.
Implementations§
Source§impl StateMachineV2
impl StateMachineV2
pub fn new(initial: &str) -> Self
pub fn add_state(&mut self, name: &str)
pub fn add_transition(&mut self, from: &str, to: &str, event: &str)
pub fn add_guarded_transition( &mut self, from: &str, to: &str, event: &str, guard: GuardFn, )
pub fn fire(&mut self, event: &str) -> bool
pub fn current(&self) -> &str
pub fn state_count(&self) -> usize
pub fn transition_count(&self) -> usize
pub fn history(&self) -> &[String]
pub fn fire_count(&self) -> u64
pub fn is_in(&self, state: &str) -> bool
pub fn can_fire(&self, event: &str) -> bool
pub fn reachable_events(&self) -> Vec<String>
Auto Trait Implementations§
impl Freeze for StateMachineV2
impl RefUnwindSafe for StateMachineV2
impl Send for StateMachineV2
impl Sync for StateMachineV2
impl Unpin for StateMachineV2
impl UnsafeUnpin for StateMachineV2
impl UnwindSafe for StateMachineV2
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