Skip to main content

Crate ferogram_derive

Crate ferogram_derive 

Source
Expand description

Procedural macros for ferogram.

This crate is part of ferogram, an async Rust MTProto client built by Ankit Chaubey.

You do not depend on this crate directly. It is re-exported through ferogram and ferogram-fsm. Add those crates to your Cargo.toml instead.

§What’s in here

  • #[derive(FsmState)]: Implements the ferogram_fsm::FsmState trait for a unit-variant enum. Generates as_key (variant name → String) and from_key (string → Option<Self>). Tuple and struct variants are rejected at compile time.

§Example

use ferogram::FsmState;

#[derive(FsmState, Clone, Debug, PartialEq)]
enum CheckoutState {
    Cart,
    Address,
    Payment,
    Confirmation,
}

Derive Macros§

FsmState
Derive the ferogram_fsm::FsmState trait for an enum.