Expand description
§Autumn Macros
Proc macros for the Autumn web framework.
This crate provides:
- Route annotation macros (
#[get],#[post], etc.) - The
routes![]collection macro - The
#[autumn_web::main]entry point macro (S-008) - The
#[model]attribute macro (S-018)
Users should not depend on this crate directly — use autumn-web instead,
which re-exports everything.
Macros§
- jobs
- Collect
#[job]handlers into aVec<JobInfo>. - mail_
previews - Collect
#[mailer_preview]impl blocks into runtime preview registrations. - one_
off_ tasks - Collect
#[task]handlers into aVec<OneOffTaskInfo>. - paths
- Emit a
pub mod paths { … }that re-exports each handler’s typed path helper. - routes
- Collect annotated route handlers into a
Vec<Route>. - static_
routes - Collect
#[static_get]handlers into aVec<StaticRouteMeta>. - t
- Translate an i18n key, with compile-time validation that the key
exists in the default locale’s
.ftlfile. - tasks
- Collect
#[scheduled]task handlers into aVec<TaskInfo>.
Attribute Macros§
- api_doc
- Enrich a route handler’s auto-generated
OpenAPIdocumentation. - authorize
- Enforce a record-level authorization policy on a route handler.
- cached
- Cache the return value of a function based on its arguments.
- delete
- Annotate an async function as a DELETE route handler.
- feature_
flag - Gate a route handler on a named feature flag.
- get
- Annotate an async function as a GET route handler.
- inbound_
mail - Annotate an async inbound mail handler function.
- job
- Declare an on-demand background job.
- mailer
- Generate
send_*anddeliver_later_*helpers for a mailer impl block. - mailer_
preview - Register zero-argument mail preview methods for the dev mail preview UI.
- main
- Set up the async runtime for an Autumn application.
- model
- Attribute macro for Autumn database models.
- oauth2_
callback - Annotate an OAuth2/OIDC callback handler.
- patch
- Annotate an async function as a PATCH route handler.
- post
- Annotate an async function as a POST route handler.
- put
- Annotate an async function as a PUT route handler.
- repository
- Derive a repository with CRUD operations and derived queries.
- scheduled
- Declare a scheduled background task.
- secured
- Secure a route handler with authentication and optional role checks.
- service
- Define a service for cross-model orchestration and non-DB side effects.
- static_
get - Annotate an async function as a statically pre-rendered GET route.
- step_up
- Require fresh (“step-up”) authentication before a route handler runs.
- task
- Declare a one-off operational task runnable with
autumn task <name>. - ws
- Annotate an async function as a WebSocket route handler.