phoxal-macros 0.19.1

Proc-macros for the phoxal framework: phoxal_api_tree!, #[derive(Runtime)], #[phoxal::runtime].
Documentation

Proc-macros for the phoxal framework.

Three macros make up the authoring surface:

  • [phoxal_api_tree!] - declares the dated API-version modules (phoxal_api::y2026_1, …), their version-local body types, the ContractBody/ApiVersion impls, and the api-local topic builders.
  • [derive@Runtime] - reads a runtime struct's typed handle fields plus the #[phoxal(id = …, api = …, config = …, contracts(…))] attribute and emits the static metadata (RuntimeFields) the runner and emit-apis consume.
  • [macro@runtime] - the bare #[phoxal::runtime] attribute on the inherent impl; it reads #[setup]/#[step(hz = N)]/#[shutdown] plus the query-side #[server]/#[server_snapshot]/#[snapshot] and emits the lifecycle and server dispatch (RuntimeBehavior).

The two struct/impl macros are paired: #[derive(Runtime)] selects the API version and contributes the field-derived contracts, while #[phoxal::runtime] adds the lifecycle methods and the server-side contracts. Both reference the one API version chosen by the derive, and the generated ContractBody<Api = Self::Api> assertions make a body from a different version a compile error.

The runtime macros (derive@Runtime / macro@runtime) reference the framework through ::phoxal::…; the engine crate makes that path resolve to itself with extern crate self as phoxal;. The phoxal_api_tree! output instead targets the bus ABI floor directly as ::phoxal_bus, since it is invoked in the phoxal-api crate, which does not depend on the engine.