pub struct And<A, B>(/* private fields */);Expand description
Passes only when both sub-rules A and B pass.
A is checked first; if it fails its error is returned and B is not run.
Both sub-rules must share the same Validator::Error type.
§Examples
use type_lib::combinator::And;
use type_lib::rules::{MaxLen, NonEmpty};
use type_lib::Validator;
type ShortNonEmpty = And<NonEmpty, MaxLen<8>>;
assert!(ShortNonEmpty::validate("ok").is_ok());
assert!(ShortNonEmpty::validate("").is_err()); // NonEmpty fails first
assert!(ShortNonEmpty::validate("way too long").is_err()); // MaxLen failsTrait Implementations§
Auto Trait Implementations§
impl<A, B> Freeze for And<A, B>
impl<A, B> RefUnwindSafe for And<A, B>
impl<A, B> Send for And<A, B>
impl<A, B> Sync for And<A, B>
impl<A, B> Unpin for And<A, B>
impl<A, B> UnsafeUnpin for And<A, B>
impl<A, B> UnwindSafe for And<A, B>
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