Skip to main content

Crate aura_derive

Crate aura_derive 

Source
Expand description

Proc macros for AURA plugins.

  • #[derive(Params) generates the full aura_params::Params impl for a struct of FloatParam / IntParam / BoolParam / EnumParam<E> / MeterSlot fields, plus #[nested] sub-structs and #[persist] plain-data fields. It also emits a <Struct>ParamId companion enum (one variant per own param field) so editors can use GainParamsParamId::Gain.id() instead of scattering raw u32 IDs.
  • #[derive(ParamEnum) generates the aura_params::ParamEnum impl for a field-less enum.

AURA owns this derive. Param IDs are always explicit (id = N); nested structs keep their declared IDs (collisions panic in new() via Params::assert_no_id_collisions). There is no compile-time plugin_info!, no framework #[derive(State)], and no silent auto-numbering.

Packaging: generated code references ::aura::params::…. Depend on the aura umbrella crate (normal author path), not aura-derive alone.

Implementation split across modules ([parse] collects fields / attributes, [codegen] turns them into TokenStreams, [params] and [param_enum] assemble the two derives) - the functions actually tagged #[proc_macro_derive] stay here since that attribute is only accepted on functions defined at the crate root.

Derive Macros§

ParamEnum
Derive ParamEnum for a C-like enum.
Params
Derive the Params implementation for a parameter struct.