Proc-macros for the phoxal framework.
Three macro families 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@Service] / [derive@Driver] / [derive@Tool] / [derive@Simulator] - read a participant struct's typed handle fields plus the#[phoxal(id = …, api = …, config = …, contracts(…))]attribute and emits the static metadata (ParticipantSpec) the runner andemit-apisconsume. - [
macro@behavior] - the bare#[phoxal::behavior]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 (ParticipantBehavior).
The struct/impl macros are paired: the derive selects the API version, records
the artifact kind, and contributes the field-derived contracts, while
#[phoxal::behavior] 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 participant authoring macros (derive@Service / derive@Driver /
derive@Tool / derive@Simulator / macro@behavior) 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.