pub enum ValidationError {
Show 60 variants
NotPositive(i128),
Negative(i128),
Zero,
NotFinite(String),
FloatNotPositive(f64),
FloatNegative(f64),
FloatOutOfRange {
value: f64,
min: f64,
max: f64,
},
OutOfRange {
value: i128,
min: i128,
max: i128,
},
EmptyString,
StringTooLong {
actual: usize,
max: usize,
},
StringTooShort {
actual: usize,
min: usize,
},
NotTrue,
NotFalse,
NotAlphabetic(char),
NotNumeric(char),
NotAlphanumeric(char),
WrongUuidVersion {
expected: u8,
got: u8,
},
NilUuid,
DurationNotPositive,
NotPrivateIp,
NotPublicIp,
ExpectedIpv4GotIpv6,
ExpectedIpv6GotIpv4,
NotLoopback,
PathDoesNotExist(String),
PathNotReadable(String),
PathNotDirectory(String),
PathNotFile(String),
DateTimeTooEarly {
value: String,
threshold: String,
},
DateTimeTooLate {
value: String,
threshold: String,
},
EmptyCollection,
OptionIsNone,
ResultIsErr,
WrongJsonType {
expected: String,
got: String,
},
JsonIsNull,
UrlInvalid,
InvalidUrlSyntax,
UrlMissingAuthority,
UrlNotAbsolute,
UrlNotHttps,
UrlNotHttp,
InvalidRegexSyntax,
UrlNoHost,
UrlCannotBeBase,
RegexInvalid,
InvalidUuidVariant,
NotUnicastMac,
NotMulticastMac,
NotUniversalMac,
NotLocalMac,
PortIsZero,
PortNotPrivileged(u16),
PortIsPrivileged(u16),
PathContainsNull,
PathNotAbsolute(String),
PathNotRelative(String),
InvalidUtf8,
TooLong {
max: usize,
actual: usize,
},
StatusCodeInvalid(u16),
HeaderInvalid(String),
}Expand description
Error type for contract validation failures.
Variants§
NotPositive(i128)
Value is not positive (must be > 0).
Negative(i128)
Value is negative (must be >= 0).
Zero
Value is zero (must be non-zero).
NotFinite(String)
Value is not finite (NaN or infinite).
FloatNotPositive(f64)
Float value is not positive (must be > 0.0).
FloatNegative(f64)
Float value is negative (must be >= 0.0).
FloatOutOfRange
Float value is out of range.
Fields
OutOfRange
Value is out of range.
Fields
EmptyString
String is empty (must be non-empty).
StringTooLong
String exceeds maximum length.
StringTooShort
String is below minimum length.
NotTrue
Bool value is not true (must be true).
NotFalse
Bool value is not false (must be false).
NotAlphabetic(char)
Char is not alphabetic.
NotNumeric(char)
Char is not numeric.
NotAlphanumeric(char)
Char is not alphanumeric.
WrongUuidVersion
UUID is wrong version.
NilUuid
UUID is nil.
DurationNotPositive
Duration is not positive (must be > zero).
NotPrivateIp
IP address is not private (not in RFC 1918 or RFC 4193 ranges).
NotPublicIp
IP address is not public.
ExpectedIpv4GotIpv6
Expected IPv4, got IPv6.
ExpectedIpv6GotIpv4
Expected IPv6, got IPv4.
NotLoopback
IP address is not loopback.
PathDoesNotExist(String)
Path does not exist on filesystem.
PathNotReadable(String)
Path is not readable.
PathNotDirectory(String)
Path is not a directory.
PathNotFile(String)
Path is not a file.
DateTimeTooEarly
DateTime is too early (before threshold).
DateTimeTooLate
DateTime is too late (after threshold).
EmptyCollection
Collection is empty (must be non-empty).
OptionIsNone
Option is None (must be Some).
ResultIsErr
Result is Err (must be Ok).
WrongJsonType
JSON Value is wrong type.
JsonIsNull
JSON Value is null.
UrlInvalid
URL is invalid or malformed.
InvalidUrlSyntax
URL syntax is invalid (RFC 3986).
UrlMissingAuthority
URL is missing authority component.
UrlNotAbsolute
URL is not absolute (missing scheme + authority).
UrlNotHttps
URL scheme is not HTTPS.
UrlNotHttp
URL scheme is not HTTP.
InvalidRegexSyntax
Regex syntax is invalid.
UrlNoHost
URL has no host component.
UrlCannotBeBase
URL cannot be a base for relative URLs.
RegexInvalid
Regex pattern is invalid or cannot be compiled.
InvalidUuidVariant
UUID variant bits are invalid (not RFC 4122 10xx pattern).
NotUnicastMac
MAC address is not unicast (is multicast).
NotMulticastMac
MAC address is not multicast (is unicast).
NotUniversalMac
MAC address is not universal (is locally administered).
NotLocalMac
MAC address is not locally administered (is universal).
PortIsZero
Port number is zero (invalid for binding).
PortNotPrivileged(u16)
Port number is not privileged (>= 1024).
PortIsPrivileged(u16)
Port number is privileged (< 1024).
PathContainsNull
Path contains null byte (invalid on Unix).
PathNotAbsolute(String)
Path is not absolute (does not start with /).
PathNotRelative(String)
Path is not relative (starts with /).
InvalidUtf8
UTF-8 validation failed.
TooLong
Value exceeds maximum length (generic).
StatusCodeInvalid(u16)
HTTP status code is invalid (must be 100–999).
HeaderInvalid(String)
HTTP header name or value is invalid.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ValidationError> for ElicitError
impl From<ValidationError> for ElicitError
Source§fn from(err: ValidationError) -> Self
fn from(err: ValidationError) -> Self
Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
impl StructuralPartialEq for ValidationError
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.