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: E
Implementations§
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, Extractor> FromRequest<State> for Modified<Extractor>
impl<State, Extractor> FromRequest<State> for Modified<Extractor>
§type Rejection = <Extractor as FromRequest<State>>::Rejection
type Rejection = <Extractor as FromRequest<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§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§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> OperationInput for Modified<T>where
T: OperationInput,
impl<T> OperationInput for Modified<T>where
T: OperationInput,
source§fn operation_input(ctx: &mut GenContext, operation: &mut Operation)
fn operation_input(ctx: &mut GenContext, operation: &mut Operation)
Modify the operation. Read more
source§fn inferred_early_responses(
ctx: &mut GenContext,
operation: &mut Operation
) -> Vec<(Option<u16>, Response)>
fn inferred_early_responses( ctx: &mut GenContext, operation: &mut Operation ) -> Vec<(Option<u16>, Response)>
Inferred early responses are used to document early returns for
extractors, guards inside handlers. For example these could represent
JSON parsing errors, authentication failures. Read more
source§impl<T> OperationOutput for Modified<T>where
T: OperationOutput,
impl<T> OperationOutput for Modified<T>where
T: OperationOutput,
§type Inner = <T as OperationOutput>::Inner
type Inner = <T as OperationOutput>::Inner
The type that is used in examples. Read more
source§fn operation_response(
ctx: &mut GenContext,
operation: &mut Operation
) -> Option<Response>
fn operation_response( ctx: &mut GenContext, operation: &mut Operation ) -> Option<Response>
Return a response documentation for this type,
alternatively modify the operation if required. Read more
source§fn inferred_responses(
ctx: &mut GenContext,
operation: &mut Operation
) -> Vec<(Option<u16>, Response)>
fn inferred_responses( ctx: &mut GenContext, operation: &mut Operation ) -> Vec<(Option<u16>, Response)>
Inferred responses are used when the type is
used as a request handler return type. Read more
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> Freeze for Modified<E>where
E: Freeze,
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
source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::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§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
source§fn call(
self,
_req: Request<Body>,
_state: S
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S ) -> <T as Handler<IntoResponseHandler, S>>::Future
Call the handler with the given request.
source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer
to the handler. Read moresource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service
by providing the statesource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service
and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read moresource§fn into_make_service_with_connect_info<C>(
self
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService
which stores information
about the incoming connection and has no state. Read moresource§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read moresource§impl<T> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP