Struct axum_valid::validify::Modified
source · pub struct Modified<E>(pub E);Expand description
Modified data extractor / response
Extractor
Modified uses validify’s modification capabilities to alter data, without validation.
Operations like trimming and case modification can be done based on modify attributes.
Response
Modified also implements the IntoResponse trait. When its inner IntoResponse type also implements the HasModify trait:
Modified will call validify’s modify method to alter the inner data.
Then call the inner type’s own into_response method to convert it into a HTTP response.
This allows applying modifications during response conversion by leveraging validify.
Tuple Fields§
§0: EImplementations§
source§impl<E> Modified<E>
impl<E> Modified<E>
sourcepub fn into_inner(self) -> E
pub fn into_inner(self) -> E
Consumes the Modified and returns the modified data within.
This returns the E type which represents the data that has been
modified.
Trait Implementations§
source§impl<State, Body, Extractor> FromRequest<State, Body> for Modified<Extractor>
impl<State, Body, Extractor> FromRequest<State, Body> for Modified<Extractor>
§type Rejection = <Extractor as FromRequest<State, Body>>::Rejection
type Rejection = <Extractor as FromRequest<State, Body>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
source§fn from_request<'life0, 'async_trait>(
req: Request<Body>,
state: &'life0 State
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn from_request<'life0, 'async_trait>(
req: Request<Body>,
state: &'life0 State
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform the extraction.
source§impl<State, Extractor> FromRequestParts<State> for Modified<Extractor>
impl<State, Extractor> FromRequestParts<State> for Modified<Extractor>
§type Rejection = <Extractor as FromRequestParts<State>>::Rejection
type Rejection = <Extractor as FromRequestParts<State>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
source§fn from_request_parts<'life0, 'life1, 'async_trait>(
parts: &'life0 mut Parts,
state: &'life1 State
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn from_request_parts<'life0, 'life1, 'async_trait>(
parts: &'life0 mut Parts,
state: &'life1 State
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Perform the extraction.
source§impl<E: IntoResponse + HasModify> IntoResponse for Modified<E>
impl<E: IntoResponse + HasModify> IntoResponse for Modified<E>
source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
source§impl<T: TypedPath + Display> TypedPath for Modified<T>
impl<T: TypedPath + Display> TypedPath for Modified<T>
source§fn with_query_params<T>(self, params: T) -> WithQueryParams<Self, T>
fn with_query_params<T>(self, params: T) -> WithQueryParams<Self, T>
Add query parameters to a path. Read more
impl<E: Copy> Copy for Modified<E>
Auto Trait Implementations§
impl<E> RefUnwindSafe for Modified<E>where
E: RefUnwindSafe,
impl<E> Send for Modified<E>where
E: Send,
impl<E> Sync for Modified<E>where
E: Sync,
impl<E> Unpin for Modified<E>where
E: Unpin,
impl<E> UnwindSafe for Modified<E>where
E: UnwindSafe,
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
§impl<S, B, T> FromRequest<S, B, ViaParts> for T
impl<S, B, T> FromRequest<S, B, ViaParts> for T
source§impl<T, S, B> Handler<IntoResponseHandler, S, B> for T
impl<T, S, B> Handler<IntoResponseHandler, S, B> for T
§type Future = Ready<Response<UnsyncBoxBody<Bytes, Error>>>
type Future = Ready<Response<UnsyncBoxBody<Bytes, Error>>>
The type of future calling this handler returns.
source§fn call(
self,
_req: Request<B>,
_state: S
) -> <T as Handler<IntoResponseHandler, S, B>>::Future
fn call( self, _req: Request<B>, _state: S ) -> <T as Handler<IntoResponseHandler, S, B>>::Future
Call the handler with the given request.
source§fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
L: Layer<HandlerService<Self, T, S, B>> + Clone,
<L as Layer<HandlerService<Self, T, S, B>>>::Service: Service<Request<NewReqBody>>,
fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
L: Layer<HandlerService<Self, T, S, B>> + Clone,
<L as Layer<HandlerService<Self, T, S, B>>>::Service: Service<Request<NewReqBody>>,
Apply a [
tower::Layer] to the handler. Read moresource§fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
Convert the handler into a [
Service] by providing the statesource§impl<H, T, B> HandlerWithoutStateExt<T, B> for H
impl<H, T, B> HandlerWithoutStateExt<T, B> for H
source§fn into_service(self) -> HandlerService<H, T, (), B>
fn into_service(self) -> HandlerService<H, T, (), B>
Convert the handler into a [
Service] and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
Convert the handler into a
MakeService and no state. Read moresource§fn into_make_service_with_connect_info<C>(
self
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, (), B>, C>
fn into_make_service_with_connect_info<C>( self ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, (), B>, C>
Convert the handler into a
MakeService which stores information
about the incoming connection and has no state. Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [
CompactString]. Read more