macro_rules! entity {
(
$(#[$meta:meta])*
pub struct $entity:ident(update $update:ident, id $id:ty) {
registers { $( $(#[$rmeta:meta])* $rvar:ident => $rfield:ident : $rty:ty ),* $(,)? }
namespaces { $( $nvar:ident => $nfield:ident : $nty:ty ),* $(,)? }
constants { $( $(#[$cmeta:meta])* $cfield:ident : $cty:ty ),* $(,)? }
}
) => { ... };
}Expand description
One entity kind from one field list: the struct and its Update enum,
plus the Entity impl. Field classes: registers (writable
leaves), namespaces (nested vocabularies addressed by descent),
constants (creation-time values — no update variant). Serde variant
names on the update enum are wire tags: written explicitly, never
derived from field names (FlipLR is not FlipLr), never renamed or
repurposed — deprecate and add instead. The struct’s field names are
the document format’s keys.