pub struct Validator { /* private fields */ }Expand description
Accumulates violations while walking an object graph, tracking the current JSON Pointer.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn report(&mut self, code: ViolationCode, message: impl Into<String>)
pub fn report(&mut self, code: ViolationCode, message: impl Into<String>)
Records a violation at the current position.
Sourcepub fn report_at(
&mut self,
field: &str,
code: ViolationCode,
message: impl Into<String>,
)
pub fn report_at( &mut self, field: &str, code: ViolationCode, message: impl Into<String>, )
Records a violation at field below the current position.
Sourcepub fn enter(&mut self, segment: &str)
pub fn enter(&mut self, segment: &str)
Descends into a named field or array index, escaping it per RFC 6901.
Sourcepub fn leave(&mut self)
pub fn leave(&mut self)
Returns to the parent of the current position.
§Panics
Panics if called more often than Validator::enter.
Sourcepub fn field(&mut self, segment: &str, value: &impl Validate)
pub fn field(&mut self, segment: &str, value: &impl Validate)
Validates value at segment below the current position.
Sourcepub fn finish(self) -> Violations
pub fn finish(self) -> Violations
Consumes the validator and yields everything it found.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnsafeUnpin for Validator
impl UnwindSafe for Validator
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