Struct jtd::ValidationErrorIndicator [−][src]
A single validation error returned by validate()
.
This type has Indicator at the end of its name to emphasize that it is not a Rust error. It is an ordinary struct, and corresponds to the concept of a validation error indicator in the JSON Typedef specification. See RFC8927, Section 3.2.
In order to avoid unncessary allocations, this struct uses
std::borrow::Cow
instead of String
directly. If you would prefer not
to have to deal with that, and are OK with copying all the data out of this
struct, then use
into_owned_paths
to
convert instances of this type into a pair of plain old Vec<String>
s.
Fields
instance_path: Vec<Cow<'a, str>>
A path to the part of the instance that was rejected.
schema_path: Vec<Cow<'a, str>>
A path to the part of the schema that rejected the instance.
Implementations
impl<'a> ValidationErrorIndicator<'a>
[src]
pub fn into_owned_paths(self) -> (Vec<String>, Vec<String>)
[src]
Converts this struct into a instance_path
and schema_path
pair.
This is a convenience function for those who don't want to manipulate
std::borrow::Cow
.
use std::borrow::Cow; let indicator = jtd::ValidationErrorIndicator { instance_path: vec![Cow::Borrowed("foo")], schema_path: vec![Cow::Owned("bar".to_owned())], }; let (instance_path, schema_path) = indicator.into_owned_paths(); assert_eq!(vec!["foo".to_owned()], instance_path); assert_eq!(vec!["bar".to_owned()], schema_path);
Trait Implementations
impl<'a> Clone for ValidationErrorIndicator<'a>
[src]
fn clone(&self) -> ValidationErrorIndicator<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for ValidationErrorIndicator<'a>
[src]
impl<'a> Eq for ValidationErrorIndicator<'a>
[src]
impl<'a> PartialEq<ValidationErrorIndicator<'a>> for ValidationErrorIndicator<'a>
[src]
fn eq(&self, other: &ValidationErrorIndicator<'a>) -> bool
[src]
fn ne(&self, other: &ValidationErrorIndicator<'a>) -> bool
[src]
impl<'a> StructuralEq for ValidationErrorIndicator<'a>
[src]
impl<'a> StructuralPartialEq for ValidationErrorIndicator<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for ValidationErrorIndicator<'a>
[src]
impl<'a> Send for ValidationErrorIndicator<'a>
[src]
impl<'a> Sync for ValidationErrorIndicator<'a>
[src]
impl<'a> Unpin for ValidationErrorIndicator<'a>
[src]
impl<'a> UnwindSafe for ValidationErrorIndicator<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,