Expand description
Request context and extractors (spec §4.1). Everything a handler needs is
visible in its signature; each parameter implements FromRequest.
Structs§
- Client
Addr - The connection’s remote socket address, threaded from the accept loop onto
parts.extensionsso it survives into the handler. A newtype so the typemap lookup is unambiguous.Nonefor synthetic requests (tasks, some tests). - Headers
- Read-only access to request headers in a handler signature.
- Path
- Typed path parameter:
Path<i64>binds the LEAF-MOST (last) captured parameter; use a tuple to address all parameters root→leaf —Path<(A, B)>/Path<(A, B, C)>grab two/three{param}s in route order. Param types are the sealedPathParamset (integers,String,bool, floats,char); custom newtypes opt in through thepath_param!macro. - Path
Params - A by-name view of the request’s captured path parameters. Where
Path<T>binds positionally (the leaf-most segment, or a root→leaf tuple),PathParamsreads a SPECIFIC mount param BY NAME — the accessor a DI factory needs, since a factory resolves each argument throughFromRequestand cannot borrow&RequestCtxto callRequestCtx::param. The membership-verifying tenancy guard uses it to read the tenant fkclub_idunder/clubs/{club_id}even when a leaf{id}follows (issues #78/#79). Rejects a task context (JC1003), like every other HTTP-coupled extractor. - Query
- Typed query string:
Query<MyParams>via serde. - RawBody
- The request body as EXACT bytes — the extractor for webhook signature
verification, where the digest must cover the wire bytes, not a re-serialized
value. Works on buffered routes (cheap clone) and
stream_body()routes (drains and caches). See the auth docs for the Stripe/Twilio recipes. - Request
Ctx - The mutable view of one in-flight request. Handlers receive extractors, not this type; middleware and the DI resolver work through it.
Traits§
- From
Request - Types that can be produced from the request. Implemented by all extractors
and by
Dep<T>(seedepmodule). - Path
Param - Types extractable from one path segment. The built-in set (integers,
String,bool, floats,char) is sealed; custom param types (id newtypes) join it through thepath_param!macro, which is the only sanctioned way to implement this trait outside the crate.