pub struct HttpRequestContext<'request> { /* private fields */ }Expand description
Mutable, request-local context shared by runtime-neutral HTTP middleware.
The base request remains borrowed. Proxy middleware can replace the effective client IP, scheme, and host without rewriting the adapter’s receive buffer. Typed extensions are allocated only when inserted.
Implementations§
Source§impl<'request> HttpRequestContext<'request>
impl<'request> HttpRequestContext<'request>
pub fn request(&self) -> &dyn HttpRequestView
pub fn client_ip(&self) -> Option<IpAddr>
pub fn set_client_ip(&mut self, client_ip: IpAddr)
pub fn scheme(&self) -> &str
pub fn set_scheme(&mut self, scheme: impl Into<String>)
pub fn host(&self) -> Option<&str>
pub fn set_host(&mut self, host: impl Into<String>)
pub fn insert_extension<T: 'static>(&mut self, value: T)
pub fn extension<T: 'static>(&self) -> Option<&T>
Sourcepub fn connection_info(&self) -> ConnectionInfo
pub fn connection_info(&self) -> ConnectionInfo
Snapshots the normalized client IP, scheme, and host so the dispatch path can carry them into the operation request context.
Auto Trait Implementations§
impl<'request> !RefUnwindSafe for HttpRequestContext<'request>
impl<'request> !Send for HttpRequestContext<'request>
impl<'request> !Sync for HttpRequestContext<'request>
impl<'request> !UnwindSafe for HttpRequestContext<'request>
impl<'request> Freeze for HttpRequestContext<'request>
impl<'request> Unpin for HttpRequestContext<'request>
impl<'request> UnsafeUnpin for HttpRequestContext<'request>
Blanket Implementations§
Source§impl<T> BackgroundExt for T
impl<T> BackgroundExt for T
fn background(self, task: BackgroundTask) -> Background<Self>
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