Skip to main content

Crate rok_ui_macros

Crate rok_ui_macros 

Source
Expand description

Procedural macros for rok-ui: entry points only.

Parsing and code generation live in rok-ui-grammar, where they are unit-tested; each macro here forwards its tokens and turns errors into compile_error!.

Macros§

children
A Vec<AnyElement> from mixed element types, with control flow:
file_route
Declare the route in a route file under src/routes/ (see rok_ui::routes!).
keyframes
Define keyframe sequences for Motion.
style
One inline style object, for one-off or dynamic values: style! { width: {px(width)}, background: primary/90 }.
styles
Define StyleX-style style objects once, at module level.
view
JSX-like markup compiled to builder calls.

Attribute Macros§

component
Turn a function into a reusable component, React style.
memoize
Memoize an async function: calls with the same arguments share one in-flight future and its result, until rok_ui::query::memo::invalidate forgets it. Arguments are owned and Debug (they form the cache key); the output is Clone + Send + Sync.
procedure
Declare a typed async command: a Procedure with optional queries to invalidate after it succeeds.

Derive Macros§

FormValues
Implement rok_ui::form::FormValues and add a typed field constant per struct field: email: String becomes pub const EMAIL: Field<Self, String>.
Search
Implement rok_ui::router::Search for a struct of query parameters.
Store
Generate NameStore, a fine-grained store with one signal per field (state feature): store.title() reads (and tracks) only title, store.set_title(..) re-renders only its readers, and store.get() / store.set(..) work on the whole value.