pub struct State<Substates: ModelState> {
pub uid_source: Uid,
pub substates: Vec<Substates>,
/* private fields */
}Expand description
State struct encapsulates the state-machine’s state.
This includes a Uid generator, a vector of one or more Substates
instances, and the current_instance field holding the index of the
currently active instance in the state-machine’s main loop.
In most scenarios, the Substates vector contains a single element.
Multiple elements mainly occur in testing scenarios where multiple
instances are simulated.
Fields§
§uid_source: Uid§substates: Vec<Substates>Implementations§
Source§impl<Substates: ModelState> State<Substates>
impl<Substates: ModelState> State<Substates>
pub fn new() -> Self
pub fn get_current_instance(&self) -> usize
pub fn set_current_instance(&mut self, instance: usize)
Sourcepub fn substate<T: 'static + Any>(&self) -> &T
pub fn substate<T: 'static + Any>(&self) -> &T
Returns a reference to the state of the currently active substate.
Sourcepub fn substate_mut<T: 'static + Any>(&mut self) -> &mut T
pub fn substate_mut<T: 'static + Any>(&mut self) -> &mut T
Returns a mutable reference to the state of the currently active substate.
Auto Trait Implementations§
impl<Substates> Freeze for State<Substates>
impl<Substates> RefUnwindSafe for State<Substates>where
Substates: RefUnwindSafe,
impl<Substates> Send for State<Substates>where
Substates: Send,
impl<Substates> Sync for State<Substates>where
Substates: Sync,
impl<Substates> Unpin for State<Substates>where
Substates: Unpin,
impl<Substates> UnwindSafe for State<Substates>where
Substates: 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