Struct fog_pack::validator::BinValidator [−][src]
pub struct BinValidator {Show 15 fields
pub comment: String,
pub bits_clr: ByteBuf,
pub bits_set: ByteBuf,
pub max: ByteBuf,
pub min: ByteBuf,
pub ex_max: bool,
pub ex_min: bool,
pub max_len: u32,
pub min_len: u32,
pub in_list: Vec<ByteBuf>,
pub nin_list: Vec<ByteBuf>,
pub query: bool,
pub bit: bool,
pub ord: bool,
pub size: bool,
}Expand description
Validator for byte sequences.
This validator type will only pass binary values (a sequence of bytes). A binary sequence can also be treated as a little-endian arbitrary-length unsigned integer. Validation passes if:
- The bits set in
bits_clrare cleared in the byte sequence. - The bits set in
bits_setare set in the byte sequence. - If
maxhas 1 or more bytes, the value is less than the maximum inmax, or equal to it ifex_maxis not set to true. - The value is greater than the minimum in
min, or equal to it ifex_minis not set to true. - The value’s length in bytes is less than or equal to the value in
max_len. - The value’s length in bytes is greater than or equal to the value in
min_len. - If the
inlist is not empty, the value must be among the values in the list. - The value must not be among the values 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: empty
- bits_set: empty
- max: empty
- min: empty
- ex_max: false
- ex_min: false
- max_len: u32::MAX
- min_len: 0
- in_list: empty
- nin_list: empty
- query: false
- bit: false
- ord: false
- size: false
Fields
comment: StringAn optional comment explaining the validator.
bits_clr: ByteBufA byte sequence used as a bit field. Any bits set in it must be cleared in an allowed value.
bits_set: ByteBufA byte sequence used as a bit field. Any bits set in it must be set in an allowed value.
max: ByteBufThe maximum allowed value, as a little-endian arbitrary-length unsigned integer. If no bytes are present, there is no maximum.
min: ByteBufThe minimum allowed value, as a little-endian arbitrary-length unsigned integer.
ex_max: boolChanges max into an exclusive maximum.
ex_min: boolChanges min into an exclusive maximum.
max_len: u32Set the maximum allowed number of bytes.
min_len: u32Set the minimum allowed number of bytes.
in_list: Vec<ByteBuf>A vector of specific allowed values, stored under the in field. If empty, this vector is not checked against.
nin_list: Vec<ByteBuf>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.
size: boolIf true, queries against matching spots may set the min_len and max_len values to
non-defaults.
Implementations
Set whether or not queries can use the in and nin lists.
Set whether or not queries can use the bits_clr and bits_set values.
Set whether or not queries can use the max, min, ex_max, and ex_min values.
Set whether or not queries can use the max_len and min_len values.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl RefUnwindSafe for BinValidator
impl Send for BinValidator
impl Sync for BinValidator
impl Unpin for BinValidator
impl UnwindSafe for BinValidator
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self