Macro pyri_state::state
source · macro_rules! state { ($state:pat $(if $guard:expr)? $(,)?) => { ... }; ($old:pat => $new:pat $(if $guard:expr)? $(,)?) => { ... }; }
Expand description
A macro for building pattern-matching FnStatePattern and FnStateTransPattern instances.
§Examples
State pattern-matching:
state!(Level(4 | 7 | 10)).on_enter(save_checkpoint)State transition pattern-matching:
state!(Level(x @ 1..=3) => y if y.0 == 10 - x).on_trans(do_something_cool)