pub struct ContractValidationErrors { /* private fields */ }Expand description
Deterministic, bounded public validation failures.
The empty value contains only inline path state. Heap-backed field paths and
messages are created only when Self::add records a failure.
Implementations§
Source§impl ContractValidationErrors
impl ContractValidationErrors
Sourcepub const fn new() -> ContractValidationErrors
pub const fn new() -> ContractValidationErrors
Create an empty validation result.
Sourcepub fn at_field(
&mut self,
field: &'static str,
validate: impl FnOnce(&mut ContractValidationErrors),
)
pub fn at_field( &mut self, field: &'static str, validate: impl FnOnce(&mut ContractValidationErrors), )
Validate within a generated object field without allocating a path.
Sourcepub fn at_index(
&mut self,
index: usize,
validate: impl FnOnce(&mut ContractValidationErrors),
)
pub fn at_index( &mut self, index: usize, validate: impl FnOnce(&mut ContractValidationErrors), )
Validate within a generated array index without allocating a path.
Sourcepub fn add(&mut self, message: &'static str)
pub fn add(&mut self, message: &'static str)
Record one public-safe validation rule failure at the current path.
Sourcepub const fn fields(&self) -> &BTreeMap<String, Vec<String>>
pub const fn fields(&self) -> &BTreeMap<String, Vec<String>>
Return retained field paths in deterministic order.
Sourcepub fn into_fields(self) -> BTreeMap<String, Vec<String>>
pub fn into_fields(self) -> BTreeMap<String, Vec<String>>
Consume the collector and return retained field paths.
Sourcepub const fn is_truncated(&self) -> bool
pub const fn is_truncated(&self) -> bool
Return whether the bounded collector has omitted further validation work.
Trait Implementations§
Source§impl Clone for ContractValidationErrors
impl Clone for ContractValidationErrors
Source§fn clone(&self) -> ContractValidationErrors
fn clone(&self) -> ContractValidationErrors
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContractValidationErrors
impl Debug for ContractValidationErrors
Source§impl Default for ContractValidationErrors
impl Default for ContractValidationErrors
Source§fn default() -> ContractValidationErrors
fn default() -> ContractValidationErrors
Returns the “default value” for a type. Read more
impl Eq for ContractValidationErrors
Source§impl PartialEq for ContractValidationErrors
impl PartialEq for ContractValidationErrors
impl StructuralPartialEq for ContractValidationErrors
Auto Trait Implementations§
impl Freeze for ContractValidationErrors
impl RefUnwindSafe for ContractValidationErrors
impl Send for ContractValidationErrors
impl Sync for ContractValidationErrors
impl Unpin for ContractValidationErrors
impl UnsafeUnpin for ContractValidationErrors
impl UnwindSafe for ContractValidationErrors
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.