pub trait RunsFSM<EventType, StateType, TransitionFnArguments, ErrorType> {
fn add_events(
&mut self,
events: &mut Vec<(EventType, OptionalFnArg<TransitionFnArguments>)>
) -> Result<u32, Errors<EventType, StateType, ErrorType>>;
fn extend_events<I>(&mut self, iter: I)
where
I: IntoIterator<Item = (EventType, Option<TransitionFnArguments>)>;
fn process_event_queue(
&mut self
) -> Result<u32, Errors<EventType, StateType, ErrorType>>;
}
Expand description
trait that can process events from a queue using a transition table
Required Methods§
sourcefn add_events(
&mut self,
events: &mut Vec<(EventType, OptionalFnArg<TransitionFnArguments>)>
) -> Result<u32, Errors<EventType, StateType, ErrorType>>
fn add_events(
&mut self,
events: &mut Vec<(EventType, OptionalFnArg<TransitionFnArguments>)>
) -> Result<u32, Errors<EventType, StateType, ErrorType>>
add events to the event queue @ the back, events are not processed
sourcefn extend_events<I>(&mut self, iter: I)where
I: IntoIterator<Item = (EventType, Option<TransitionFnArguments>)>,
fn extend_events<I>(&mut self, iter: I)where
I: IntoIterator<Item = (EventType, Option<TransitionFnArguments>)>,
add events to the event queue @ the back from an iterator, events are not processed
sourcefn process_event_queue(
&mut self
) -> Result<u32, Errors<EventType, StateType, ErrorType>>
fn process_event_queue(
&mut self
) -> Result<u32, Errors<EventType, StateType, ErrorType>>
process the whole event queue. Observe that this can generate multiple messages and queue events against the FSM itself again so don’t rely which state the machine ends up in
returns
- number of events processed or errors encountered.
On errors not much can be done
except killing the FSM instance