Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.

[Feature Request] Allow pre-declaring the enumerate type's output for Derive usage #37

@Dessix

Description

@Dessix

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.
  }

  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions