Struct Validated

Source
pub struct Validated<E>(pub E);
Expand description

§Validated data extractor

Validated provides simple data validation based on validify.

It only does validation, usage is similar to Valid.

Tuple Fields§

§0: E

Implementations§

Source§

impl<E> Validated<E>

Source

pub fn into_inner(self) -> E

Consumes the Validated and returns the validated data within.

This returns the E type which represents the data that has been successfully validated.

Trait Implementations§

Source§

impl<E: Clone> Clone for Validated<E>

Source§

fn clone(&self) -> Validated<E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug> Debug for Validated<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Default> Default for Validated<E>

Source§

fn default() -> Validated<E>

Returns the “default value” for a type. Read more
Source§

impl<E> Deref for Validated<E>

Source§

type Target = E

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<E> DerefMut for Validated<E>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: Display> Display for Validated<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<State, Extractor> FromRequest<State> for Validated<Extractor>
where State: Send + Sync, Extractor: HasValidate + FromRequest<State>, Extractor::Validate: Validate,

Source§

type Rejection = ValidationRejection<ValidationErrors, <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§

async fn from_request( req: Request, state: &State, ) -> Result<Self, Self::Rejection>

Perform the extraction.
Source§

impl<State, Extractor> FromRequestParts<State> for Validated<Extractor>
where State: Send + Sync, Extractor: HasValidate + FromRequestParts<State>, Extractor::Validate: Validate,

Source§

type Rejection = ValidationRejection<ValidationErrors, <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§

async fn from_request_parts( parts: &mut Parts, state: &State, ) -> Result<Self, Self::Rejection>

Perform the extraction.
Source§

impl<T> OperationInput for Validated<T>
where T: OperationInput,

Source§

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)>

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: TypedPath + Display> TypedPath for Validated<T>

Source§

const PATH: &'static str = T::PATH

The path with optional captures such as /users/{id}.
Source§

fn to_uri(&self) -> Uri

Convert the path into a Uri. Read more
Source§

fn with_query_params<T>(self, params: T) -> WithQueryParams<Self, T>
where T: Serialize, Self: Sized,

Add query parameters to a path. Read more
Source§

impl<E: Copy> Copy for Validated<E>

Auto Trait Implementations§

§

impl<E> Freeze for Validated<E>
where E: Freeze,

§

impl<E> RefUnwindSafe for Validated<E>
where E: RefUnwindSafe,

§

impl<E> Send for Validated<E>
where E: Send,

§

impl<E> Sync for Validated<E>
where E: Sync,

§

impl<E> Unpin for Validated<E>
where E: Unpin,

§

impl<E> UnwindSafe for Validated<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<S, T> FromRequest<S, ViaParts> for T
where S: Send + Sync, T: FromRequestParts<S>,

Source§

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§

fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>

Perform the extraction.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoApi for T

Source§

fn into_api<A>(self) -> UseApi<T, A>

into UseApi
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ValidateIp for T
where T: ToString,

Source§

fn validate_ipv4(&self) -> bool

Validates whether the given string is an IP V4
Source§

fn validate_ipv6(&self) -> bool

Validates whether the given string is an IP V6
Source§

fn validate_ip(&self) -> bool

Validates whether the given string is an IP
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,