pub enum length<V> {
bytes(V),
chars(V),
}Expand description
Validator forwards length to inner validator.
§Examples
use seventy::{
builtins::{compare::*, string::*},
seventy, Newtype,
};
#[seventy(validate(length::chars(le(15))))]
pub struct TextBox(String);
// Successfully constructed because the string is <= 15 characters.
assert!(TextBox::try_new("Hello, World!").is_ok());
// Unsuccessfully constructed because the string is not <= 15 characters.
assert!(TextBox::try_new("Hello, World! I am hungry.").is_err());Variants§
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for length<V>where
V: Freeze,
impl<V> RefUnwindSafe for length<V>where
V: RefUnwindSafe,
impl<V> Send for length<V>where
V: Send,
impl<V> Sync for length<V>where
V: Sync,
impl<V> Unpin for length<V>where
V: Unpin,
impl<V> UnwindSafe for length<V>where
V: UnwindSafe,
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