Skip to main content

Crate ferro_macros

Crate ferro_macros 

Source
Expand description

Procedural macros for the Ferro framework

This crate provides compile-time validated macros for:

  • Inertia.js responses with component validation
  • Named route redirects with route validation
  • Service auto-registration
  • Handler attribute for controller methods
  • FormRequest for validated request data
  • Jest-like testing with describe! and test! macros

Macros§

asset
Embed a static asset at compile time and register it as a content-hashed ferro::bundle::Bundle, returning the hashed URL as &'static str.
describe
Group related tests with a descriptive name
inertia_response
Create an Inertia response with compile-time component validation
redirect
Create a redirect to a path or named route
test
Define an individual test case with a descriptive name

Attribute Macros§

action
Attribute macro for POST-style action handlers that mutate state and redirect.
domain_error
Define a domain error with automatic HTTP response conversion
ferro_test
Attribute macro for database-enabled tests
handler
Attribute macro for controller handler methods
injectable
Attribute macro to auto-register a concrete type as a singleton
memoize
Mark an async fn or async impl method for request-scoped memoization.
request
Attribute macro for clean request data definition
resource_get
Attribute macro for GET handlers displaying a single tenant-scoped resource.
resource_post
Attribute macro for POST handlers mutating a single tenant-scoped resource.
service
Mark a trait as a service for the App container

Derive Macros§

ApiResource
Derive macro for generating Resource trait implementation from struct annotations
Authenticatable
Derive the Authenticatable trait so Auth::user_as::<T>() works.
FerroModel
Derive macro for reducing SeaORM model boilerplate
FormRequest
Derive macro for FormRequest trait
InertiaProps
Derive macro for generating Serialize implementation for Inertia props
ValidateRules
Derive macro for declarative struct validation using Ferro’s rules