pub struct ValidationErrorIndicator<'a> {
pub instance_path: Vec<Cow<'a, str>>,
pub schema_path: Vec<Cow<'a, str>>,
}Expand description
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§
Source§impl<'a> ValidationErrorIndicator<'a>
impl<'a> ValidationErrorIndicator<'a>
Sourcepub fn into_owned_paths(self) -> (Vec<String>, Vec<String>)
pub fn into_owned_paths(self) -> (Vec<String>, Vec<String>)
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§
Source§impl<'a> Clone for ValidationErrorIndicator<'a>
impl<'a> Clone for ValidationErrorIndicator<'a>
Source§fn clone(&self) -> ValidationErrorIndicator<'a>
fn clone(&self) -> ValidationErrorIndicator<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for ValidationErrorIndicator<'a>
impl<'a> Debug for ValidationErrorIndicator<'a>
Source§impl<'a> PartialEq for ValidationErrorIndicator<'a>
impl<'a> PartialEq for ValidationErrorIndicator<'a>
Source§fn eq(&self, other: &ValidationErrorIndicator<'a>) -> bool
fn eq(&self, other: &ValidationErrorIndicator<'a>) -> bool
self and other values to be equal, and is used by ==.