Skip to main content

Crate arkhe_forge_macros

Crate arkhe_forge_macros 

Source
Expand description

Runtime-layer derive + attribute macros for ArkheForge.

Three derives — #[derive(ArkheComponent)], #[derive(ArkheAction)], #[derive(ArkheEvent)] — emit the sealed-trait impl plus the marker-trait impl pinning TYPE_CODE / SCHEMA_VERSION (and, for ArkheAction, BAND / IDEMPOTENT).

One attribute — #[arkhe_pure] — asserts that an Action::compute body conforms to E14.L1 Subset-Rust purity (clock / RNG / I/O / FFI deny-list). Backed by arkhe-subset-rust-check.

§Compile-time validation

  • #[arkhe(type_code = N)] mandatory; N must lie in the appropriate reserved sub-range (or the shell-scoped extension range).
  • First named struct field must be schema_version: u16 (wire version tag).
  • #[arkhe(band = K)] mandatory for ArkheAction; K ∈ {1, 2, 3}.
  • #[arkhe(idempotent)] opt-in on ArkheAction — requires the struct to carry an idempotency_key field.
  • Field-level #[arkhe(canonical_sort)] on ArkheComponent / ArkheEvent is allowed only on Vec<T> / BTreeSet<T> fields.

§Namespace

Do not confuse with arkhe-macros (L0 kernel derives). This crate targets the Runtime traits in arkhe_forge_core::{component, action, event, sealed}; the L0 derive crate is orthogonal.

Attribute Macros§

arkhe_pure
#[arkhe_pure] — attribute macro asserting that an Action::compute- style function body conforms to E14.L1 Subset-Rust purity. Backed by arkhe-subset-rust-check; emits a compile_error! per violation site. Spec anchor: E14.L1 (MC).

Derive Macros§

ArkheAction
Derive ArkheAction — emits the sealed-trait impl and the marker-trait impl pinning TYPE_CODE, SCHEMA_VERSION, BAND, IDEMPOTENT.
ArkheComponent
Derive ArkheComponent — emits the sealed-trait impl and the marker-trait impl pinning TYPE_CODE and SCHEMA_VERSION.
ArkheEvent
Derive ArkheEvent — emits the sealed-trait impl and the marker-trait impl pinning TYPE_CODE and SCHEMA_VERSION.