pub trait State<Engine> {
// Required methods
fn toggle(engine: &mut Engine, inner: Option<&Self>) -> bool;
fn load(engine: &mut Engine) -> Self;
fn run(&mut self, engine: &mut Engine);
fn drop(&mut self, engine: &mut Engine);
}Required Methods§
Sourcefn toggle(engine: &mut Engine, inner: Option<&Self>) -> bool
fn toggle(engine: &mut Engine, inner: Option<&Self>) -> bool
This determines whether or not to run this local state machine.
Sourcefn load(engine: &mut Engine) -> Self
fn load(engine: &mut Engine) -> Self
This creates and imports new initial state on this local state machine when the toggle’s on.
Sourcefn run(&mut self, engine: &mut Engine)
fn run(&mut self, engine: &mut Engine)
This executes custom logics and manipulates this local state machine’s states.
Sourcefn drop(&mut self, engine: &mut Engine)
fn drop(&mut self, engine: &mut Engine)
When the toggle’s off … After then, the sub states[i.e) StateBar and StateBar2] will be droped automatically.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.