pub struct Each<V>(/* private fields */);Expand description
Validates every item of a collection with V.
The violation of the first invalid item is reported with its index as
parameter index, its code is the code of the violation of the item.
For an Option the value is validated if there is one.
use deser_validate::{Each, Email, Validator};
let emails = vec!["jane@example.com".to_string(), "nope".to_string()];
let violation = Each::<Email>::validate(&emails).unwrap_err();
assert_eq!(violation.message(), "item 1: must be an email address");
assert!(Each::<Email>::validate(&None::<String>).is_ok());Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for Each<V>
impl<V> RefUnwindSafe for Each<V>
impl<V> Send for Each<V>
impl<V> Sync for Each<V>
impl<V> Unpin for Each<V>
impl<V> UnsafeUnpin for Each<V>
impl<V> UnwindSafe for Each<V>
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