Skip to main content

controller

Attribute Macro controller 

Source
#[controller]
Expand description

Attribute macro for a controller’s impl block.

Reads the routes! { … } block inside the impl and generates the controller’s Controller implementation — its route table, parameter extraction, and dispatch. Attribute options: prepare = Self::method (a hook run before every handler in the controller), lax (relax strict parameter rejection), rate_limit = "class" (stamp a rate-limit class onto matched requests), and max_body_bytes = N (per-controller request-body cap, in bytes).