Trait sfsm::Transition [−][src]
pub trait Transition<DestinationState>: Into<DestinationState> { pub fn guard(&self) -> bool; pub fn entry(&mut self) { ... } pub fn execute(&mut self) { ... } pub fn exit(&mut self) { ... } }
Trait that must be implemented by a state that want to transition to DestinationState.
All states can have none or many transitions.
Both the entry and exit function will only be executed once for each state. The execute
function will be executed as long as the state does not transition into another state.
On top of the transition trait the state must implement the Into
Required methods
pub fn guard(&self) -> bool
[src]
Specifies when the state has to transit. As long as the guard returns false, the state stays in the current state. When true is returned, the state machine will transit to DestinationState
Provided methods
pub fn entry(&mut self)
[src]
Implement any behavior that hast to be executed when entering the state.
pub fn execute(&mut self)
[src]
Implement any behavior that has to be executed when the state is being executed. This function will be called as long as the state does not transit.
pub fn exit(&mut self)
[src]
Implement any behavior that hast to be executed when exiting the state.