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, theContractBody/ApiVersionimpls, 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 andemit-apisconsume. - [
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.