pub enum CheckerOption {
Optional(bool),
Multiple(bool),
}Expand description
Option you can set to a checker.
§Examples
let mut params = std::collections::HashMap::new();
params.insert("tags".to_string(), vec!["red".to_string(), "blue".to_string()]);
let mut validator = Validator::new();
validator
.check(Checker::new("tags", "标签", Str)
.set(CheckerOption::Optional(true))
.set(CheckerOption::Multiple(true))
.meet(Rule::Min(1)));
validator.validate(¶ms);
assert!(validator.is_valid());Variants§
Optional(bool)
True means this field is allowed to be missing, default false(required).
Multiple(bool)
True means this field consists of multiple values, default false(single value).
Auto Trait Implementations§
impl Freeze for CheckerOption
impl RefUnwindSafe for CheckerOption
impl Send for CheckerOption
impl Sync for CheckerOption
impl Unpin for CheckerOption
impl UnwindSafe for CheckerOption
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