#[non_exhaustive]pub enum CastError {
Unsupported(String),
Invalid {
cast: String,
reason: String,
},
Pattern(Error),
NeedsAsync(String),
Failed {
cast: String,
message: String,
},
Rejected(String),
}Expand description
A value that cannot be cast, or a cast that cannot be understood.
laravel::Error takes it with ? as a 500. When the value came from a request, match on it and answer a 422
for CastError::Rejected and CastError::Invalid.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unsupported(String)
The cast name is not one this port knows.
Invalid
The cast is known but its arguments or the value are not usable.
Pattern(Error)
A date pattern the cast was given cannot be used.
NeedsAsync(String)
The cast hashes, and hashing is asynchronous: use the _async form.
Failed
The framework could not hash or encrypt the value, or decrypt it.
Rejected(String)
A value that came from outside (a request, JSON) and that the cast refuses, in the cast’s own words.
What a crate::ColumnCast of your own answers, and what crate::canonical shows.
Trait Implementations§
impl Eq for CastError
Source§impl Error for CastError
impl Error for CastError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
impl StructuralPartialEq for CastError
Auto Trait Implementations§
impl Forget for CastError
impl Freeze for CastError
impl Move for CastError
impl RefUnwindSafe for CastError
impl Send for CastErrorwhere
RawVecInner: Send,
impl Sync for CastErrorwhere
RawVecInner: Sync,
impl Unpin for CastError
impl UnsafeUnpin for CastError
impl UnwindSafe for CastErrorwhere
RawVecInner: 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§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 more