state_shift

Attribute Macro type_state

Source
#[type_state]
Expand description

Turns your struct into type-state compatible version.

Usage: #[type_state(state_slots = 3, default_state = Initial)]

Arguments:

  • state_slots -> if you want to track multiple states at the same time
  • default_state -> the initial state of your struct, you must provide a one of the states defined in the #[states] macro

also protects your struct from getting initialized with random types/states by enforcing sealed-trait bounds on the states.