pub struct RequestContext<'server: 'req, 'req> { /* private fields */ }
Expand description
Represents the context of an HTTP request, providing access to both the request headers and any path parameters extracted from the URL.
The lifetime parameters ensure that the request context does not outlive the server or the request data it references.
Implementations§
Source§impl<'server, 'req> RequestContext<'server, 'req>
impl<'server, 'req> RequestContext<'server, 'req>
Sourcepub fn new(
request_header: &'req RequestHeader,
path_params: &'req PathParams<'server, 'req>,
) -> Self
pub fn new( request_header: &'req RequestHeader, path_params: &'req PathParams<'server, 'req>, ) -> Self
Creates a new RequestContext with the given request header and path parameters
Sourcepub fn request_header(&self) -> &RequestHeader
pub fn request_header(&self) -> &RequestHeader
Returns a reference to the underlying RequestHeader
Sourcepub fn path_params(&self) -> &PathParams<'_, '_>
pub fn path_params(&self) -> &PathParams<'_, '_>
Returns a reference to the path parameters extracted from the request URL
Auto Trait Implementations§
impl<'server, 'req> Freeze for RequestContext<'server, 'req>
impl<'server, 'req> !RefUnwindSafe for RequestContext<'server, 'req>
impl<'server, 'req> Send for RequestContext<'server, 'req>
impl<'server, 'req> Sync for RequestContext<'server, 'req>
impl<'server, 'req> Unpin for RequestContext<'server, 'req>
impl<'server, 'req> !UnwindSafe for RequestContext<'server, 'req>
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