Skip to main content

Crate autumn_macros

Crate autumn_macros 

Source
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 a Vec<JobInfo>.
mail_previews
Collect #[mailer_preview] impl blocks into runtime preview registrations.
one_off_tasks
Collect #[task] handlers into a Vec<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 a Vec<StaticRouteMeta>.
t
Translate an i18n key, with compile-time validation that the key exists in the default locale’s .ftl file.
tasks
Collect #[scheduled] task handlers into a Vec<TaskInfo>.

Attribute Macros§

api_doc
Enrich a route handler’s auto-generated OpenAPI documentation.
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_* and deliver_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.