Skip to main content

Crate ix_schema

Crate ix_schema 

Source
Expand description

§ix-schema — a universal meta-interface for data structures

ix-schema does not serialize anything itself. It is an orchestrator: a #[derive(Ix)] type publishes a compile-time Manifest describing its fields, memory layout and schema evolution. Drivers (adapters around serde, zerocopy, …) read that manifest and do the real work, branching on const data that folds away — no reflection, no runtime schema parsing.

The crate is #![no_std] for normal builds; everything the manifest carries is const and therefore free at runtime.

§The two manifests

There are two strictly separate representations:

  • the compile-time IR that lives only inside the ix-schema-derive proc-macro while it analyses a struct, and
  • the const Manifest emitted into your crate, read by drivers.

This crate defines the second one — the contract every driver speaks.

Macros§

assert_compatible
Statically assert that $new is a layout-compatible, append-only extension of $old (see Manifest::extends). Fails compilation if a carried field was moved, resized or dropped — catching wire-format breakage before runtime.
migrate_chain
Generate the transitive closure of Upgrade impls for a schema chain.

Structs§

EvolutionSpec
How a schema version relates to the one before it.
FieldSpec
Description of a single field within a Manifest.
LayoutSpec
In-memory layout of a type.
Manifest
The semantic manifest: the single source of truth drivers read.
VariantFieldSpec
Description of a single payload field of a data-carrying enum variant.
VariantSpec
Description of a single enum variant.

Enums§

FieldChange
A single field-level change between two adjacent schema versions.
Repr
The #[repr(..)] of a type, as far as it affects layout stability.
VariantKind
How an enum variant carries its payload.

Traits§

Driver
A driver adapts an external representation (serde, zerocopy, …) to any Ix type by reading its Manifest.
Ix
The compile-time description of a #[derive(Ix)] type.
MigrateFrom
A type-safe, compile-time migration edge from an older schema version Prev.
Upgrade
A multi-hop migration from an older schema Self to a later one Target.

Derive Macros§

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