Skip to main content

Crate resuma_macros

Crate resuma_macros 

Source
Expand description

Resuma procedural macros.

These macros are the surface area Resuma exposes to user code:

  • view! — JSX-like template syntax that builds a View tree.
  • [#[component]] — turns a function into a Resuma component.
  • [#[server]] — exposes an async fn as a server action / RPC.
  • [#[island]] — marks an interactive island (its handlers ship to JS).
  • js! — escape hatch for raw JavaScript handler bodies.

The interesting one is view!: it walks the JSX-ish tokens, recognises onClick={...} style attributes, and feeds the closure body to resuma-rs2js to produce a JS chunk. The Rust side only stores a HandlerRef pointing at that chunk so SSR can emit data-r-on:click=….

Macros§

js
js! — raw JavaScript escape hatch for event handlers.
view
view! — JSX-like template macro.

Attribute Macros§

component
#[component] — registers a function as a Resuma component.
island
#[island] — marks a component as an interactive island. Its event handlers are extracted and shipped to the client as a single chunk.
layout
#[layout] — Resuma Flow layout wrapper for nested pages.
load
#[load] — Resuma Flow server data loader (runs before page render).
middleware
#[middleware] — Resuma Flow request middleware.
server
#[server] — exposes an async fn as a server action callable from actions::name(...) in the browser.
submit
#[submit] — Resuma Flow form submission handler.