Skip to main content

Ix

Derive Macro Ix 

Source
#[derive(Ix)]
{
    // Attributes available to this derive:
    #[ix]
}
Expand description

Derive a compile-time Manifest (and, with migrate_from, a type-safe migration edge) for a struct or enum. See the crate-level docs for the attributes. Derive ix_schema::Ix, publishing a compile-time semantic manifest.

Works on structs (named, tuple, newtype, or unit — tuple positions become fields "0", "1", …) and enums — both fieldless (variants + discriminants) and data-carrying (variants + payload field types; variant-payload byte offsets are not modelled, since Rust gives no const access to them). Only unions are rejected.

§Attributes

Struct-level #[ix(...)]:

  • version = N — schema version (default 1).
  • migrate_from = M — declares this version evolved from version M.

Field-level #[ix(...)]:

  • since = N — version the field was introduced in (default 1).
  • default = EXPR — value for a field absent in the previous version.
  • with = PATH — function converting the predecessor’s field.
  • rename_from = "old" — the field’s name in the previous version.