Expand description
Procedural macros for Bern declarations.
The macros parse with bern-syntax, the same parser the build tool
uses, check declarations against the shared component specifications
and expand them into Rust that rustc type-checks. They never generate
UI code: targets do that from the collected description.
Macros§
- style
- The application’s style overrides and motion tokens. The build tool
reads and checks them; for
rustcthe declaration only has to parse. - tr
- Localized text. Only valid inside
ui!and#[label(...)]. - ui
- The UI declaration grammar. Only valid as the body of a
#[component].
Attribute Macros§
- component
- Declare an exportable component whose body is one
ui!declaration.#[component(features = X)]makes the component the scope of the feature contractX. - features
- Declare a feature contract: what users can do within a component’s scope, and the commands each feature is implemented by.
- players
- Declare the media players owned by the application. Every field is a
Player; its name is the stableplayer_idall entries use. - protocol
- Declare an application protocol: value types, a read-only state struct and a command trait.
- session
- Declare typed session state owned by the window hosting a component.
- value
- Declare an enum or record used by UI declarations outside a protocol.