Skip to main content

fsm

Attribute Macro fsm 

Source
#[fsm]
Expand description

Attribute macro that bundles the typed-FSM derive quintet + serde tag + catalog registration. Use on a closed enum:

#[gen_macros::fsm(label = "gen.cargo.lock-lifecycle-state")]
pub enum LockLifecycleState {
    Unlocked { current_lock_hash: String },
    Locked   { spec_hash: String, lock_hash: String },
    Drifted  { committed_lock_hash: String, current_lock_hash: String },
    MissingLock,
}

Expands to:

#[derive(Clone, Debug, PartialEq, Eq,
         serde::Serialize, serde::Deserialize,
         gen_macros::TypedDispatcher,
         gen_macros::Discriminant,
         gen_macros::IsVariant)]
#[serde(tag = "kind", rename_all = "kebab-case")]
pub enum LockLifecycleState { /* ... */ }

gen_platform::register_dispatcher!(
    "gen.cargo.lock-lifecycle-state",
    LockLifecycleState
);

The consumer crate must depend on gen_macros, gen_platform, and serde with the derive feature.