It would be helpful if the enum produced by typestate(enumerate = ...) could be pre-declared such that #[derive(...)] can be used upon it or potentially (a subset of?) its members.
#[typestate(enumerate = "StateMachineStates")
pub mod state_machine {
#[automaton]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StateMachine;
#[state] pub struct In;
#[state] pub struct Out;
// No field-specific annotations
#[enumerate]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StateMachineStates;
// or, with fields annotated for another annotation-macro
#[enumerate]
#[derive(derivative)]
#[derivative(Debug)]
pub enum StateMachineStates {
#[derivative(Debug="transparent")]
In,
// Note that only some states are included
// Any not explicitly mentioned are filled in prior to other #[derive]s expanding.
}
// ...
}