Skip to main content

FacetError

Enum FacetError 

Source
pub enum FacetError {
Show 17 variants LengthViolation { message: String, }, MinLengthViolation { actual: u64, min: u64, }, MaxLengthViolation { actual: u64, max: u64, }, PatternViolation { value: String, pattern: String, }, EnumerationViolation { value: String, }, MinInclusiveViolation { value: String, min: String, }, MaxInclusiveViolation { value: String, max: String, }, MinExclusiveViolation { value: String, min: String, }, MaxExclusiveViolation { value: String, max: String, }, TotalDigitsViolation { actual: u32, max: u32, }, FractionDigitsViolation { actual: u32, max: u32, }, ExplicitTimezoneViolation { message: String, }, InvalidPattern { pattern: String, message: String, }, DerivationRestriction { message: String, }, FixedFacetViolation { facet_name: String, base_value: String, derived_value: String, }, ConflictingFacets { message: String, }, NotApplicable { facet: String, type_name: String, },
}
Expand description

Facet-related errors (validation and derivation)

Variants§

§

LengthViolation

Value violates length constraint

Fields

§message: String
§

MinLengthViolation

Value violates minLength constraint

Fields

§actual: u64
§min: u64
§

MaxLengthViolation

Value violates maxLength constraint

Fields

§actual: u64
§max: u64
§

PatternViolation

Value doesn’t match pattern

Fields

§value: String
§pattern: String
§

EnumerationViolation

Value not in enumeration

Fields

§value: String
§

MinInclusiveViolation

Value violates minInclusive constraint

Fields

§value: String
§

MaxInclusiveViolation

Value violates maxInclusive constraint

Fields

§value: String
§

MinExclusiveViolation

Value violates minExclusive constraint

Fields

§value: String
§

MaxExclusiveViolation

Value violates maxExclusive constraint

Fields

§value: String
§

TotalDigitsViolation

Value violates totalDigits constraint

Fields

§actual: u32
§max: u32
§

FractionDigitsViolation

Value violates fractionDigits constraint

Fields

§actual: u32
§max: u32
§

ExplicitTimezoneViolation

Value violates explicitTimezone constraint

Fields

§message: String
§

InvalidPattern

Invalid pattern regex

Fields

§pattern: String
§message: String
§

DerivationRestriction

Facet derivation error - derived type is not more restrictive

Fields

§message: String
§

FixedFacetViolation

Facet derivation error - fixed facet cannot be overridden

Fields

§facet_name: String
§base_value: String
§derived_value: String
§

ConflictingFacets

Facet derivation error - conflicting facets

Fields

§message: String
§

NotApplicable

Facet not applicable to this type

Fields

§facet: String
§type_name: String

Implementations§

Source§

impl FacetError

Source

pub fn length(message: impl Into<String>) -> Self

Create a length violation error

Source

pub fn pattern(value: impl Into<String>, pattern: impl Into<String>) -> Self

Create a pattern violation error

Source

pub fn enumeration(value: impl Into<String>) -> Self

Create an enumeration violation error

Source

pub fn derivation(message: impl Into<String>) -> Self

Create a derivation restriction error

Source

pub fn fixed_violation( facet_name: impl Into<String>, base_value: impl Into<String>, derived_value: impl Into<String>, ) -> Self

Create a fixed facet violation error

Source

pub fn conflicting(message: impl Into<String>) -> Self

Create a conflicting facets error

Trait Implementations§

Source§

impl Clone for FacetError

Source§

fn clone(&self) -> FacetError

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 FacetError

Source§

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

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

impl Display for FacetError

Source§

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

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

impl Error for FacetError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<FacetError> for ValidationError

Source§

fn from(e: FacetError) -> Self

Converts to this type from the input type.

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<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<T> ErasedDestructor for T
where T: 'static,

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> MaybeSendSync for T

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.