#[non_exhaustive]pub enum PrimitiveError {
Empty,
TooShort {
min: usize,
actual: usize,
},
TooLong {
max: usize,
actual: usize,
},
OutOfRange {
min: u128,
max: u128,
actual: u128,
},
Invalid {
message: &'static str,
},
}Expand description
Error returned when a primitive value fails validation.
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.
Empty
The value was empty or contained only whitespace.
TooShort
The value was shorter than the minimum allowed length.
TooLong
The value was longer than the maximum allowed length.
OutOfRange
The value was outside the inclusive allowed range.
Invalid
The value did not match the expected format or pattern.
Trait Implementations§
Source§impl Clone for PrimitiveError
impl Clone for PrimitiveError
Source§fn clone(&self) -> PrimitiveError
fn clone(&self) -> PrimitiveError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrimitiveError
impl Debug for PrimitiveError
Source§impl Display for PrimitiveError
impl Display for PrimitiveError
Source§impl Error for PrimitiveError
Available on crate feature std only.
impl Error for PrimitiveError
Available on crate feature
std only.1.30.0 · 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()
Source§impl PartialEq for PrimitiveError
impl PartialEq for PrimitiveError
Source§fn eq(&self, other: &PrimitiveError) -> bool
fn eq(&self, other: &PrimitiveError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PrimitiveError
impl StructuralPartialEq for PrimitiveError
Auto Trait Implementations§
impl Freeze for PrimitiveError
impl RefUnwindSafe for PrimitiveError
impl Send for PrimitiveError
impl Sync for PrimitiveError
impl Unpin for PrimitiveError
impl UnsafeUnpin for PrimitiveError
impl UnwindSafe for PrimitiveError
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