pub struct Not<A>(/* private fields */);Expand description
Passes exactly when the sub-rule A fails.
Not inverts any Validator, regardless of its error type, and reports a
ValidationError with code "not" when A unexpectedly passes.
§Examples
use type_lib::combinator::Not;
use type_lib::rules::Ascii;
use type_lib::Validator;
// Require that a string is *not* pure ASCII.
type NonAscii = Not<Ascii>;
assert!(NonAscii::validate("café").is_ok()); // not ASCII -> passes
assert!(NonAscii::validate("plain").is_err()); // ASCII -> failsTrait Implementations§
Auto Trait Implementations§
impl<A> Freeze for Not<A>
impl<A> RefUnwindSafe for Not<A>
impl<A> Send for Not<A>
impl<A> Sync for Not<A>
impl<A> Unpin for Not<A>
impl<A> UnsafeUnpin for Not<A>
impl<A> UnwindSafe for Not<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