pub trait State {
// Provided methods
fn entry(&mut self) { ... }
fn execute(&mut self) { ... }
fn exit(&mut self) { ... }
}
Expand description
Trait that must be implemented by all states
Allows to define behavior when entering, exiting and running the state. 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. There can only ever be one single state active.
Provided Methods§
Sourcefn entry(&mut self)
fn entry(&mut self)
Implement any behavior that hast to be executed when entering the state.
fn entry(&mut self) {
println!("Called right after being transitioned into");
}