pub struct ValidOption<T>(pub Option<T>);Expand description
Validated Option allows your extractors to use either a valid
T, or a missing T, but reject an invalid T, based on the
definition of ‘missing’ for those items.
For this to work, the crate that defines the extractor must
implement FromRequestPartsOptional for the extractor.
Tuple Fields§
§0: Option<T>Trait Implementations§
Source§impl<S, B, T> FromRequest<S, B> for ValidOption<T>
impl<S, B, T> FromRequest<S, B> for ValidOption<T>
Source§type Rejection = <T as FromRequest<S, B>>::Rejection
type Rejection = <T as FromRequest<S, B>>::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<S, T> FromRequestParts<S> for ValidOption<T>
impl<S, T> FromRequestParts<S> for ValidOption<T>
Source§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.
Auto Trait Implementations§
impl<T> Freeze for ValidOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for ValidOption<T>where
T: RefUnwindSafe,
impl<T> Send for ValidOption<T>where
T: Send,
impl<T> Sync for ValidOption<T>where
T: Sync,
impl<T> Unpin for ValidOption<T>where
T: Unpin,
impl<T> UnwindSafe for ValidOption<T>where
T: 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, B, T> FromRequest<S, B, ViaParts> for T
impl<S, B, T> FromRequest<S, B, ViaParts> for T
Source§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.