pub struct LengthRangeRule { /* private fields */ }Expand description
Validates that a string’s length is within an inclusive range [min, max].
This is a convenience wrapper that combines MinLengthRule and MaxLengthRule.
§Examples
use mx20022_validate::rules::length::LengthRangeRule;
use mx20022_validate::rules::Rule;
let rule = LengthRangeRule::new(1, 35);
assert!(rule.validate("hello", "/path").is_empty());
assert!(!rule.validate("", "/path").is_empty());
assert!(!rule.validate(&"x".repeat(36), "/path").is_empty());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LengthRangeRule
impl RefUnwindSafe for LengthRangeRule
impl Send for LengthRangeRule
impl Sync for LengthRangeRule
impl Unpin for LengthRangeRule
impl UnsafeUnpin for LengthRangeRule
impl UnwindSafe for LengthRangeRule
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