pub struct IntValidator {
pub comment: String,
pub bits_clr: u64,
pub bits_set: u64,
pub max: Integer,
pub min: Integer,
pub ex_max: bool,
pub ex_min: bool,
pub in_list: Vec<Integer>,
pub nin_list: Vec<Integer>,
pub query: bool,
pub bit: bool,
pub ord: bool,
}Expand description
Validator for integer values.
This validator type will only pass integers. Validation passes if:
- The bits set in
bits_clrare cleared in the integer - The bits set in
bits_setare set in the integer - The integer is less than the maximum in
max, or equal to it ifex_maxis not set to true. - The integer is greater than the minimum in
min, or equal to it ifex_minis not set to true. - If the
inlist is not empty, the integer must be among the integers in it. - The integer must not be among the integers in the
ninlist.
§Defaults
Fields that aren’t specified for the validator use their defaults instead. The defaults for each field are:
- comment: “”
- bits_clr: 0
- bits_set: 0
- max: u64::MAX
- min: i64::MIN
- ex_max: false
- ex_min: false
- in_list: empty
- nin_list: empty
- query: false
- bit: false
- ord: false
Fields§
§comment: StringAn optional comment explaining the validator.
bits_clr: u64An unsigned 64-bit integers used as a bit field. Any bits set in it must be cleared in an allowed value.
bits_set: u64An unsigned 64-bit integers used as a bit field. Any bits set in it must be set in an allowed value.
max: IntegerThe maximum allowed integer value.
min: IntegerThe minimum allowed integer value.
ex_max: boolChanges max into an exclusive maximum.
ex_min: boolChanges min into an exclusive maximum.
in_list: Vec<Integer>A vector of specific allowed values, stored under the in field. If empty, this vector is not checked against.
nin_list: Vec<Integer>A vector of specific unallowed values, stored under the nin field.
query: boolIf true, queries against matching spots may have values in the in or nin lists.
bit: boolIf true, queries against matching spots may set the bits_clr and bits_set values to be
non-zero.
ord: boolIf true, queries against matching spots may set the max, min, ex_max, and ex_min
values to non-defaults.
Implementations§
Source§impl IntValidator
impl IntValidator
Sourcepub fn query(self, query: bool) -> Self
pub fn query(self, query: bool) -> Self
Set whether or not queries can use the in and nin lists.
Sourcepub fn bit(self, bit: bool) -> Self
pub fn bit(self, bit: bool) -> Self
Set whether or not queries can use the bits_clr and bits_set values.
Trait Implementations§
Source§impl Clone for IntValidator
impl Clone for IntValidator
Source§fn clone(&self) -> IntValidator
fn clone(&self) -> IntValidator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more