Trait axum::RequestExt
source · [−]pub trait RequestExt<B>: Sealed<B> + Sized {
fn extract<E, M>(self) -> BoxFuture<'static, Result<E, E::Rejection>>
where
E: FromRequest<(), B, M> + 'static,
M: 'static;
fn extract_with_state<E, S, M>(
self,
state: &S
) -> BoxFuture<'_, Result<E, E::Rejection>>
where
E: FromRequest<S, B, M> + 'static,
S: Send + Sync;
fn extract_parts<E>(&mut self) -> BoxFuture<'_, Result<E, E::Rejection>>
where
E: FromRequestParts<()> + 'static;
fn extract_parts_with_state<'a, E, S>(
&'a mut self,
state: &'a S
) -> BoxFuture<'a, Result<E, E::Rejection>>
where
E: FromRequestParts<S> + 'static,
S: Send + Sync;
}
Expand description
Extension trait that adds additional methods to Request
.
Required Methods
Apply an extractor to this Request
.
This is just a convenience for E::from_request(req, &())
.
Note this consumes the request. Use RequestExt::extract_parts
if you’re not extracting
the body and don’t want to consume the request.
sourcefn extract_with_state<E, S, M>(
self,
state: &S
) -> BoxFuture<'_, Result<E, E::Rejection>>where
E: FromRequest<S, B, M> + 'static,
S: Send + Sync,
fn extract_with_state<E, S, M>(
self,
state: &S
) -> BoxFuture<'_, Result<E, E::Rejection>>where
E: FromRequest<S, B, M> + 'static,
S: Send + Sync,
Apply an extractor that requires some state to this Request
.
This is just a convenience for E::from_request(req, state)
.
Note this consumes the request. Use RequestExt::extract_parts_with_state
if you’re not
extracting the body and don’t want to consume the request.
sourcefn extract_parts<E>(&mut self) -> BoxFuture<'_, Result<E, E::Rejection>>where
E: FromRequestParts<()> + 'static,
fn extract_parts<E>(&mut self) -> BoxFuture<'_, Result<E, E::Rejection>>where
E: FromRequestParts<()> + 'static,
Apply a parts extractor to this Request
.
This is just a convenience for E::from_request_parts(parts, state)
.
sourcefn extract_parts_with_state<'a, E, S>(
&'a mut self,
state: &'a S
) -> BoxFuture<'a, Result<E, E::Rejection>>where
E: FromRequestParts<S> + 'static,
S: Send + Sync,
fn extract_parts_with_state<'a, E, S>(
&'a mut self,
state: &'a S
) -> BoxFuture<'a, Result<E, E::Rejection>>where
E: FromRequestParts<S> + 'static,
S: Send + Sync,
Apply a parts extractor that requires some state to this Request
.
This is just a convenience for E::from_request_parts(parts, state)
.