pub struct ValidationError<'a> {
pub instance: Cow<'a, Value>,
pub kind: ValidationErrorKind,
pub instance_path: Location,
pub schema_path: Location,
}
Expand description
An error that can occur during validation.
Fields§
§instance: Cow<'a, Value>
Value of the property that failed validation.
kind: ValidationErrorKind
Type of validation error.
instance_path: Location
Path to the value that failed validation.
schema_path: Location
Path to the JSON Schema keyword that failed validation.
Implementations§
Source§impl<'a> ValidationError<'a>
Shortcuts for creation of specific error kinds.
impl<'a> ValidationError<'a>
Shortcuts for creation of specific error kinds.
Sourcepub fn masked<'b>(&'b self) -> MaskedValidationError<'a, 'b, 'static>
pub fn masked<'b>(&'b self) -> MaskedValidationError<'a, 'b, 'static>
Returns a wrapper that masks instance values in error messages. Uses “value” as a default placeholder.
Sourcepub fn masked_with<'b, 'c>(
&'b self,
placeholder: impl Into<Cow<'c, str>>,
) -> MaskedValidationError<'a, 'b, 'c>
pub fn masked_with<'b, 'c>( &'b self, placeholder: impl Into<Cow<'c, str>>, ) -> MaskedValidationError<'a, 'b, 'c>
Returns a wrapper that masks instance values in error messages with a custom placeholder.
Sourcepub fn to_owned(self) -> ValidationError<'static>
pub fn to_owned(self) -> ValidationError<'static>
Converts the ValidationError
into an owned version with 'static
lifetime.
Trait Implementations§
Source§impl<'a> Debug for ValidationError<'a>
impl<'a> Debug for ValidationError<'a>
Source§impl Display for ValidationError<'_>
Textual representation of various validation errors.
impl Display for ValidationError<'_>
Textual representation of various validation errors.
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)>
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 From<Error> for ValidationError<'_>
impl From<Error> for ValidationError<'_>
Source§impl From<FromUtf8Error> for ValidationError<'_>
impl From<FromUtf8Error> for ValidationError<'_>
Source§fn from(err: FromUtf8Error) -> Self
fn from(err: FromUtf8Error) -> Self
Converts to this type from the input type.
Source§impl From<ValidationError<'_>> for ErrorDescription
impl From<ValidationError<'_>> for ErrorDescription
Source§fn from(e: ValidationError<'_>) -> Self
fn from(e: ValidationError<'_>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for ValidationError<'a>
impl<'a> !RefUnwindSafe for ValidationError<'a>
impl<'a> Send for ValidationError<'a>
impl<'a> Sync for ValidationError<'a>
impl<'a> Unpin for ValidationError<'a>
impl<'a> !UnwindSafe for ValidationError<'a>
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