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 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).
Auto Trait Implementations§
impl !Freeze for RequestCtx
impl !RefUnwindSafe for RequestCtx
impl !Sync for RequestCtx
impl !UnwindSafe for RequestCtx
impl Send for RequestCtx
impl Unpin for RequestCtx
impl UnsafeUnpin for RequestCtx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more