pub struct RangeStrlenValidator(pub usize, pub usize);Expand description
A validator that checks if the length of a string is within a specified range.
§Example
use ic_dbms_api::prelude::{RangeStrlenValidator, Validate, Value, Text};
let validator = RangeStrlenValidator(3, 10);
let value = Value::Text(Text("Hello".to_string()));
assert!(validator.validate(&value).is_ok());
let short_value = Value::Text(Text("Hi".to_string()));
assert!(validator.validate(&short_value).is_err());
let long_value = Value::Text(Text("Hello, World!".to_string()));
assert!(validator.validate(&long_value).is_err());Tuple Fields§
§0: usize§1: usizeTrait Implementations§
Auto Trait Implementations§
impl Freeze for RangeStrlenValidator
impl RefUnwindSafe for RangeStrlenValidator
impl Send for RangeStrlenValidator
impl Sync for RangeStrlenValidator
impl Unpin for RangeStrlenValidator
impl UnwindSafe for RangeStrlenValidator
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