pub struct CollectErrors { /* private fields */ }Expand description
Collects the errors of a whole deserialization (a value of the
Context).
With this in the context, maps and sequences collect the errors of their
items and deserialization continues to find the other errors (see
State::set_collect_errors). The limit of errors is optional:
use deser::de::CollectErrors;
use deser::Context;
let config = deser_json::DeserializerConfig::builder()
.context(Context::with(CollectErrors::with_max_errors(10)))
.build();
let err = config.from_str::<Vec<u32>>(r#"["a", 1, true]"#).unwrap_err();
assert_eq!(err.errors().count(), 2);Implementations§
Source§impl CollectErrors
impl CollectErrors
Sourcepub const fn new() -> CollectErrors
pub const fn new() -> CollectErrors
Collects errors without limit.
Sourcepub const fn with_max_errors(max: usize) -> CollectErrors
pub const fn with_max_errors(max: usize) -> CollectErrors
Collects errors up to a limit (see set_max_errors).
Sourcepub const fn set_max_errors(&mut self, max: usize)
pub const fn set_max_errors(&mut self, max: usize)
Limits the number of errors that are collected (see
State::set_max_errors).
Sourcepub const fn max_errors(&self) -> Option<usize>
pub const fn max_errors(&self) -> Option<usize>
Returns the limit of errors (see set_max_errors).
Trait Implementations§
Source§impl Clone for CollectErrors
impl Clone for CollectErrors
impl Copy for CollectErrors
Source§impl Debug for CollectErrors
impl Debug for CollectErrors
Source§impl Default for CollectErrors
impl Default for CollectErrors
impl Eq for CollectErrors
Source§impl PartialEq for CollectErrors
impl PartialEq for CollectErrors
impl StructuralPartialEq for CollectErrors
Auto Trait Implementations§
impl Freeze for CollectErrors
impl RefUnwindSafe for CollectErrors
impl Send for CollectErrors
impl Sync for CollectErrors
impl Unpin for CollectErrors
impl UnsafeUnpin for CollectErrors
impl UnwindSafe for CollectErrors
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.