pub struct Violation {
pub location: String,
pub severity: Severity,
pub error: SpecError,
}Expand description
A single problem found in a document.
Fields§
§location: StringA JSON-Pointer-like path to the offending object.
severity: SeverityHow seriously to take it.
error: SpecErrorWhat is wrong.
Trait Implementations§
impl Eq for Violation
Source§impl Error for Violation
A violation is a line in a report rather than a link in a chain, so it
carries no cause.
impl Error for Violation
A violation is a line in a report rather than a link in a chain, so it carries no cause.
A validation run yields a list, and every consumer prints that list —
Router::validate hands one back, and Error::Invalid renders one. Display
is self-contained for that reason, so offering the SpecError it already
names as a source() would make any reporter print the same sentence twice.
The implementation is still worth having: it is what lets a single violation
be boxed, returned through ?, or downcast back out of a dyn Error.
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()
impl StructuralPartialEq for Violation
Auto Trait Implementations§
impl Freeze for Violation
impl RefUnwindSafe for Violation
impl Send for Violation
impl Sync for Violation
impl Unpin for Violation
impl UnsafeUnpin for Violation
impl UnwindSafe for Violation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.