pub struct LenRange<const MIN: usize, const MAX: usize>;Expand description
Accepts values whose length is in the inclusive range MIN..=MAX.
§Examples
use type_lib::rules::LenRange;
use type_lib::Validator;
// A typical username constraint: 3 to 16 characters.
assert!(LenRange::<3, 16>::validate("alice").is_ok());
assert!(LenRange::<3, 16>::validate("ab").is_err());
assert!(LenRange::<3, 16>::validate("this-name-is-far-too-long").is_err());Trait Implementations§
Auto Trait Implementations§
impl<const MIN: usize, const MAX: usize> Freeze for LenRange<MIN, MAX>
impl<const MIN: usize, const MAX: usize> RefUnwindSafe for LenRange<MIN, MAX>
impl<const MIN: usize, const MAX: usize> Send for LenRange<MIN, MAX>
impl<const MIN: usize, const MAX: usize> Sync for LenRange<MIN, MAX>
impl<const MIN: usize, const MAX: usize> Unpin for LenRange<MIN, MAX>
impl<const MIN: usize, const MAX: usize> UnsafeUnpin for LenRange<MIN, MAX>
impl<const MIN: usize, const MAX: usize> UnwindSafe for LenRange<MIN, MAX>
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