#[require]Expand description
Denotes which state is required for this method to be called.
Usage:
#[require(State1)]- or with multiple state slots:
#[require(State1, State2, ...)]
What it does:
- generates a specific
implblock for the method, - adds the required types and generics to the
implblock, - adds the hidden
_statefield to theSelf { }struct, so you don’t have to worry about anything regarding type-state-pattern, - to be able to do all these, it needs to know the name of the struct.
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.