macro_rules! init_transition {
($target_state_tag:ident) => { ... };
}
Expand description
Sugar for constructing a InitResult::TargetState
enum variant containing the target of the
initial transition. Can be either used in TopState::init
or State<Tag>::init
ยงExample
impl TopState for BasicStateMachine{
type Evt = BasicEvt;
fn init(&mut self) -> InitResult<Self> {
init_transition!(S0)
}
}
#[state(super_state= Top)]
impl State<S0> for BasicStateMachine{
fn init(&mut self) -> InitResult<Self> {
println!("S0-INIT");
init_transition!(S1)
}
fn handle(&mut self, evt: & BasicEvt) -> HandleResult<Self> {
match evt{
_ => ignored!()
}
}
}