pub struct ValidationError<L> { /* private fields */ }Expand description
A single validation problem, with the path of element names from the
document root down to (and including) the element it occurred on, and
an optional location if Element::location provided one.
Generic over L (== the reporting Element implementation’s own
Element::Location) rather than hardcoding a formatted String, so
a caller with real per-node position data (line/column/byte offset,
or anything else) gets it back out structured, not as text to
re-parse.
Implementations§
Source§impl<L> ValidationError<L>
impl<L> ValidationError<L>
Sourcepub fn kind(&self) -> &ValidationErrorKind
pub fn kind(&self) -> &ValidationErrorKind
What kind of problem this is.
Sourcepub fn path(&self) -> &[ExpandedName]
pub fn path(&self) -> &[ExpandedName]
The element names from the document root down to (and including) the element this problem occurred on.
Sourcepub fn location(&self) -> Option<&L>
pub fn location(&self) -> Option<&L>
The location Element::location provided for the affected
element, if any.
Trait Implementations§
Source§impl<L: Clone> Clone for ValidationError<L>
impl<L: Clone> Clone for ValidationError<L>
Source§impl<L: Debug> Debug for ValidationError<L>
impl<L: Debug> Debug for ValidationError<L>
Source§impl<L: Display> Display for ValidationError<L>
impl<L: Display> Display for ValidationError<L>
impl<L: Eq> Eq for ValidationError<L>
Source§impl<L: Debug + Display> Error for ValidationError<L>
impl<L: Debug + Display> Error for ValidationError<L>
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<L: PartialEq> PartialEq for ValidationError<L>
impl<L: PartialEq> PartialEq for ValidationError<L>
impl<L: PartialEq> StructuralPartialEq for ValidationError<L>
Auto Trait Implementations§
impl<L> Freeze for ValidationError<L>
impl<L> RefUnwindSafe for ValidationError<L>where
Option<L>: RefUnwindSafe,
impl<L> Send for ValidationError<L>
impl<L> Sync for ValidationError<L>
impl<L> Unpin for ValidationError<L>
impl<L> UnsafeUnpin for ValidationError<L>where
Option<L>: UnsafeUnpin,
impl<L> UnwindSafe for ValidationError<L>where
Option<L>: UnwindSafe,
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