state_shift

Attribute Macro states

source
#[states]
Expand description

Denotes which states will be used for the type-state pattern.

Usage: #[states(State1, State2, ...)]

What it does:

  • defines the set of states that a type can transition between,
  • generates marker structs for these states
  • seals these traits and structs with TypeStateProtector trait for each state,
  • provides the necessary struct_name information to #[require] macro

To save the users of this library from having to provide the name of the struct to each #[require] macro, #[states] macro handles that for you, providing the name of the struct to the #[require] macro behind the scenes.