pub struct RequestCtx { /* private fields */ }Expand description
The mutable view of one in-flight request. Handlers receive extractors, not this type; middleware and the DI resolver work through it.
Implementations§
Source§impl RequestCtx
impl RequestCtx
Source§impl RequestCtx
impl RequestCtx
pub fn method(&self) -> &Method
pub fn uri(&self) -> &Uri
pub fn headers(&self) -> &HeaderMap
Sourcepub fn param(&self, name: &str) -> Option<&str>
pub fn param(&self, name: &str) -> Option<&str>
The named path parameter captured by the router, if present. Unlike
Path<T> (which binds the leaf-most param), a guard can address a specific
mount param by name — e.g. the tenant fk club_id under /clubs/{club_id}.
Sourcepub fn peer_addr(&self) -> Option<SocketAddr>
pub fn peer_addr(&self) -> Option<SocketAddr>
The remote peer’s socket address, if the transport provided one. Set by the
serve loop from accept(); absent for task contexts and synthetic requests.
Rate limiting uses the IP here as its last-resort partition key; treat it as
the raw TCP peer (a proxy’s address behind a load balancer).
Sourcepub fn take_extension<T: Send + Sync + 'static>(&mut self) -> Option<T>
pub fn take_extension<T: Send + Sync + 'static>(&mut self) -> Option<T>
Remove a typed extension from the request parts. jerrycan-realtime takes
hyper’s OnUpgrade handle this way to run a WebSocket after replying 101.
Remove-not-get: the handle is single-use and !Clone.