Skip to main content

renderable

Attribute Macro renderable 

Source
#[renderable]
Expand description

Attribute macro that turns a named struct into a renderable HTML element.

The macro argument supplies the HTML tag name (e.g. #[renderable(div)]), and each struct field becomes an attribute of that tag. It generates implementations of the Render and ElementDefaults traits so the struct can be emitted as <tag attrs>children</tag>. Fields named children hold nested content; bool fields render as boolean attributes and Option fields are omitted when None. A field-level #[..(name = "...")] attribute overrides the rendered attribute name.