state-m-macro 0.1.3

The library implements convenient macros for state-m crate.
Documentation

<<<<<<< HEAD

TODO

=======

state-m-macro


Summary

Macros for state-m. The only exported macro is 'state_tag'.

Usage

  • Define 'Tag' enum to distinguish different state handles(sources and readers), all handles must use different tag values.
  • Derive traits necessary: Clone, Debug, PartialEq, Eq, Hash.
  • Use 'state_tag' attribute macro to decorate the 'Tag' enum.
  • Add 'kv_assoc' attribute to all variants of the 'Tag' enum, use 'assoc' (mandatory) to associate corresponding state type, use 'label' (optional) if you want human readable labels when debuging the state machine.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[state_tag]
pub enum Tag {
    #[kv_assoc(assoc = String, label = format!("Layer_{}", self.0))]
    Inner(usize),
    #[kv_assoc(assoc = String, label = "from outer")]
    Outer,
    #[kv_assoc(assoc = CustomType, label = "custom_type")]
    OuterEx1,
    #[kv_assoc(assoc = usize)]
    OuterEx2,
}
>>>>>>> 700d7d3f1b7935aceae2943db4c5713764195030