pub struct MaxStrlenValidator(pub usize);Expand description
A validator that checks if the length of a string does not exceed a maximum length.
§Example
use ic_dbms_api::prelude::{MaxStrlenValidator, Validate, Value, Text};
let validator = MaxStrlenValidator(10);
let value = Value::Text(Text("Hello".to_string()));
assert!(validator.validate(&value).is_ok());
let long_value = Value::Text(Text("Hello, World!".to_string()));
assert!(validator.validate(&long_value).is_err());Tuple Fields§
§0: usizeTrait Implementations§
Source§impl Validate for MaxStrlenValidator
impl Validate for MaxStrlenValidator
Source§fn validate(&self, value: &Value) -> IcDbmsResult<()>
fn validate(&self, value: &Value) -> IcDbmsResult<()>
Validates the given
crate::prelude::Value. Read moreAuto Trait Implementations§
impl Freeze for MaxStrlenValidator
impl RefUnwindSafe for MaxStrlenValidator
impl Send for MaxStrlenValidator
impl Sync for MaxStrlenValidator
impl Unpin for MaxStrlenValidator
impl UnwindSafe for MaxStrlenValidator
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