Crate rwf_macros

Source

Macros§

  • Create a template context, automatically converting Rust data types into Rwf template values.
  • Create CRUD routes for the controller.
  • Create a route and mount an engine on it.
  • Not currently used.
  • Render a template with an optional context, and return it as an HTTP response.
  • 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.
  • Create REST routes for the controller.
  • Create a route from the HTTP path to the controller.
  • Render a Turbo Stream.

Attribute Macros§

  • 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§

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