pub trait StateMachineBuilder<T, U, V, W>{
// Required methods
fn new(top_state: V) -> Self;
fn name(self, name: String) -> Self;
fn build(self) -> W;
}Expand description
Builder for a StateMachine.
Required Methods§
Sourcefn new(top_state: V) -> Self
fn new(top_state: V) -> Self
Make a new StateMachineBuilder from a TopState.
§Example
#[moku::state_machine]
mod example {
#[moku::machine_module]
pub mod machine {}
use machine::State;
pub struct Top;
impl moku::TopState for Top {}
}
use moku::StateMachineBuilder;
use example::machine::Builder;
let builder = Builder::new(example::Top);
let machine = builder.build();Sourcefn name(self, name: String) -> Self
Available on crate feature std only.
fn name(self, name: String) -> Self
std only.Set the name of the StateMachine.
If not set, defaults to the state_machine module’s name in UpperCamel case.
§Example
let machine = Builder::new(example::Top).name("Kikai".to_owned()).build();
assert_eq!(machine.name(), "Kikai");Sourcefn build(self) -> W
fn build(self) -> W
Build the StateMachine.
§Example
#[moku::state_machine]
mod example {
#[moku::machine_module]
pub mod machine {}
use machine::State;
pub struct Top;
impl moku::TopState for Top {}
}
use moku::StateMachineBuilder;
use example::machine::Builder;
let builder = Builder::new(example::Top);
let machine = builder.build();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.