pub struct RouteDef {
pub pattern: &'static str,
pub handler_id: &'static str,
pub handler: &'static str,
pub verb: &'static [Verb],
pub params: &'static [ParamDef],
pub doc: Option<&'static str>,
}Expand description
The compile-time description of one route in a controller, recorded by the
routes! macro. The framework matches and dispatches against these, and
tools can introspect them (e.g. the OpenAPI generator).
Fields§
§pattern: &'static strThe route pattern relative to the controller’s mount (e.g.
"posts/{id}").
handler_id: &'static strInternal dispatch token ("handler_0", "handler_1", …) produced by
the #[controller] macro. Opaque to user code; for the
human-readable handler method name (useful for OpenAPI operationIds
and the like), see RouteDef::handler.
handler: &'static strHandler method name as written in the controller’s impl block
("list", "get", "create", …). Captured at macro-expansion time
so introspection tools (OpenAPI doc generators, route audit scripts)
can identify the handler without grepping.
verb: &'static [Verb]Verbs this route accepts. Always non-empty: a single-element slice for
an explicitly declared verb, DEFAULT_VERBS for an unmarked route.
params: &'static [ParamDef]The route’s declared parameters, in order.
doc: Option<&'static str>The handler method’s /// doc comment, if any — surfaced to tools like
the OpenAPI generator.