Trait axum_core::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
; fn with_limited_body(self) -> Result<Request<Limited<B>>, Request<B>>; fn into_limited_body(self) -> Result<Limited<B>, B>; }
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.

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.

Apply a parts extractor to this Request.

This is just a convenience for E::from_request_parts(parts, state).

Apply a parts extractor that requires some state to this Request.

This is just a convenience for E::from_request_parts(parts, state).

Apply the default body limit.

If it is disabled, return the request as-is in Err.

Consumes the request, returning the body wrapped in Limited if a default limit is in place, or not wrapped if the default limit is disabled.

Implementations on Foreign Types§

Implementors§