Crate rwf_macros

Crate rwf_macros 

Source

Macros§

context
Create a template context, automatically converting Rust data types into Rwf template values.
crud
Create CRUD routes for the controller.
engine
Create a route and mount an engine on it.
error
Not currently used.
render
Render a template with an optional context, and return it as an HTTP response.
render_include
Include the template into the executable at compile time and render it at runtime. Templates rendered this way don’t have to be stored on disk in production.
rest
Create REST routes for the controller.
route
Create a route from the HTTP path to the controller.
turbo_stream
Render a Turbo Stream.

Attribute Macros§

controller
Create an Rwf controller from an async function. The function must accept a &Request argument and return a Result<Response, Error>, just like the async fn handle method from the Controller trait.

Derive Macros§

Context
Allows to automatically convert a Rust struct into a template context. Templates can then define strictly-typed contexts for additional type safety.
Form
Automatically implement the FromFormData trait. Allows to extract values from a HTTP form and convert it to a Rust struct.
FromRow
Automatically implement the FromRow trait. Converts database rows to Rust struct fields.
Model
The #[derive(Model)] macro.
ModelController
Create a Model controller.
PageController
Create a Page controller.
RestController
Create a REST controller.
TemplateValue
Automatically implement the ToTemplateValue trait for the Rust struct. This allows to use the struct directly in template contexts.
WebsocketController
Create a WebSocket controller.