pub struct JsonForm<'a> { /* private fields */ }Expand description
Accumulates field-extraction failures from a JsonObject into a single
ValidationError.
Create one with new, pull each field with
str_field, then call finish to get
Ok(()) or every collected Violation at once.
Implementations§
Source§impl<'a> JsonForm<'a>
impl<'a> JsonForm<'a>
Sourcepub fn new(object: &'a JsonObject) -> Self
pub fn new(object: &'a JsonObject) -> Self
Starts a form over object with no recorded violations.
Sourcepub fn errors(&self) -> &ValidationError
pub fn errors(&self) -> &ValidationError
Borrows the violations recorded so far.
Sourcepub fn finish(self) -> ValidateResult
pub fn finish(self) -> ValidateResult
Consumes the form: Ok(()) if every field validated, otherwise Err
with all collected violations.
Auto Trait Implementations§
impl<'a> Freeze for JsonForm<'a>
impl<'a> RefUnwindSafe for JsonForm<'a>
impl<'a> Send for JsonForm<'a>
impl<'a> Sync for JsonForm<'a>
impl<'a> Unpin for JsonForm<'a>
impl<'a> UnsafeUnpin for JsonForm<'a>
impl<'a> UnwindSafe for JsonForm<'a>
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