Struct axum_core::extract::RequestParts
source · [−]pub struct RequestParts<B> { /* private fields */ }
Expand description
The type used with FromRequest
to extract data from requests.
Has several convenience methods for getting owned parts of the request.
Implementations
sourceimpl<B> RequestParts<B>
impl<B> RequestParts<B>
sourcepub fn new(req: Request<B>) -> Self
pub fn new(req: Request<B>) -> Self
Create a new RequestParts
.
You generally shouldn’t need to construct this type yourself, unless
using extractors outside of axum for example to implement a
tower::Service
.
sourcepub fn try_into_request(self) -> Result<Request<B>, BodyAlreadyExtracted>
pub fn try_into_request(self) -> Result<Request<B>, BodyAlreadyExtracted>
sourcepub fn method_mut(&mut self) -> &mut Method
pub fn method_mut(&mut self) -> &mut Method
Gets a mutable reference to the request method.
sourcepub fn version_mut(&mut self) -> &mut Version
pub fn version_mut(&mut self) -> &mut Version
Gets a mutable reference to the request HTTP version.
sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Gets a mutable reference to the request headers.
sourcepub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
Gets a reference to the request extensions.
sourcepub fn extensions_mut(&mut self) -> &mut Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
Gets a mutable reference to the request extensions.
sourcepub fn body(&self) -> Option<&B>
pub fn body(&self) -> Option<&B>
Gets a reference to the request body.
Returns None
if the body has been taken by another extractor.
Trait Implementations
Auto Trait Implementations
impl<B> !RefUnwindSafe for RequestParts<B>
impl<B> Send for RequestParts<B> where
B: Send,
impl<B> Sync for RequestParts<B> where
B: Sync,
impl<B> Unpin for RequestParts<B> where
B: Unpin,
impl<B> !UnwindSafe for RequestParts<B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more