Skip to main content

ErrorCondition

Enum ErrorCondition 

Source
pub enum ErrorCondition {
Show 19 variants StringTooShort { min_length: Option<u64>, }, StringTooLong { max_length: Option<u64>, }, GreaterThan { value: Option<i64>, }, GreaterThanEqual { value: Option<i64>, }, LessThan { value: Option<i64>, }, LessThanEqual { value: Option<i64>, }, Enum { values: Option<Vec<String>>, }, StringPatternMismatch { pattern: Option<String>, }, EmailFormat, UuidFormat, DatetimeFormat, DateFormat, FormatError, TypeMismatch { expected_type: String, }, Missing, AdditionalProperties { field: String, }, TooFewItems { min_items: Option<usize>, }, TooManyItems, ValidationError,
}
Expand description

Represents the different types of validation errors that can occur

Variants§

§

StringTooShort

String length is below minimum

Fields

§min_length: Option<u64>
§

StringTooLong

String length exceeds maximum

Fields

§max_length: Option<u64>
§

GreaterThan

Number is not greater than exclusive minimum

Fields

§value: Option<i64>
§

GreaterThanEqual

Number is not greater than or equal to minimum

Fields

§value: Option<i64>
§

LessThan

Number is not less than exclusive maximum

Fields

§value: Option<i64>
§

LessThanEqual

Number is not less than or equal to maximum

Fields

§value: Option<i64>
§

Enum

Value is not one of allowed enum values

Fields

§values: Option<Vec<String>>
§

StringPatternMismatch

String does not match pattern

Fields

§pattern: Option<String>
§

EmailFormat

Email format validation failed

§

UuidFormat

UUID format validation failed

§

DatetimeFormat

Date-time format validation failed

§

DateFormat

Date format validation failed

§

FormatError

Other format validation failed

§

TypeMismatch

Type mismatch

Fields

§expected_type: String
§

Missing

Required field is missing

§

AdditionalProperties

Additional properties not allowed

Fields

§field: String
§

TooFewItems

Array has too few items

Fields

§min_items: Option<usize>
§

TooManyItems

Array has too many items

§

ValidationError

Fallback for unmapped errors

Implementations§

Source§

impl ErrorCondition

Source

pub fn from_schema_error(schema_path_str: &str, error_msg: &str) -> Self

Determine the error condition from schema path and error message

Source

pub const fn error_type(&self) -> &'static str

Get the error type code for this condition

Source

pub const fn default_message(&self) -> &'static str

Get default message for this error condition

Trait Implementations§

Source§

impl Clone for ErrorCondition

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ErrorCondition

Source§

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

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

impl Default for ErrorCondition

Source§

fn default() -> Self

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

impl Eq for ErrorCondition

Source§

impl PartialEq for ErrorCondition

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorCondition

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.