arkhe-forge-macros 0.13.0

Derive + attribute macros for ArkheForge Runtime: ArkheComponent / ArkheAction / ArkheEvent + #[arkhe_pure] (E14.L1 Subset-Rust purity). Validates TYPE_CODE ranges, BAND classification, schema_version field shape, and Action::compute purity at compile time.
Documentation

arkhe-forge-macros

Runtime-layer derive macros for ArkheForge Runtime.

Three procedural derives targeting the L1 traits in arkhe-forge-core: ArkheComponent, ArkheAction, ArkheEvent. Do not confuse with arkhe-macros, which targets the L0 kernel traits.

Layer

Companion proc-macro crate for arkhe-forge-core. Consumers normally pull the derives through the core crate's re-export; direct use is reserved for compile-fail tests and advanced shell authors.

Derives

  • #[derive(ArkheComponent)] — emits the sealed impl and pins TYPE_CODE / SCHEMA_VERSION.
  • #[derive(ArkheAction)] — additionally pins BAND ∈ {1, 2, 3} and IDEMPOTENT (opt-in).
  • #[derive(ArkheEvent)] — same shape as Component.

Compile-time validation enforces:

  • #[arkhe(type_code = N)] sits in the correct reserved sub-range.
  • First named field is schema_version: u16 (wire version tag).
  • #[arkhe(band = K)] present for ArkheAction, K ∈ {1, 2, 3}.
  • #[arkhe(idempotent)] requires an idempotency_key field.
  • #[arkhe(canonical_sort)] is allowed only on Vec<T> / BTreeSet<T> fields.

Quick start

use arkhe_forge_core::ArkheComponent;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, ArkheComponent)]
#[arkhe(type_code = 0x0001_0002)]
struct UserProfile {
    schema_version: u16,
    display_name: String,
}

Documentation

License

Dual-licensed under MIT OR Apache-2.0 at your option.