Struct fog_pack::validator::KeyValidator [−][src]
pub struct KeyValidator {
pub matches: Option<Box<Regex>>,
pub normalize: Normalize,
pub max_len: u32,
pub min_len: u32,
}Expand description
Special validator for the keys in a Map. Used by MapValidator.
This validator type will only pass UTF-8 strings as map keys. Validation passes if:
- The number of bytes in the string is less than or equal to
max_len. - The number of bytes in the string is greater than or equal to
min_len. - If a regular expression is present in
matches, the possibly-normalized string must match against the expression.
The normalize field sets any Unicode normalization that should be applied to the string. See
StrValidator’s documentation for details.
Defaults
Fields that aren’t specified for the validator use their defaults instead. The defaults for each field are:
- comment: “”
- matches: None
- normalize: Normalize::None
- max_len: u32::MAX
- min_len: 0
Fields
matches: Option<Box<Regex>>A regular expression that the value must match against.
normalize: NormalizeThe Unicode normalization setting.
max_len: u32The maximum allowed number of bytes in the string value.
min_len: u32The minimum allowed number of bytes in the string value.
Implementations
Set the unicode normalization form to use for in, nin, and matches checks.
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
Auto Trait Implementations
impl RefUnwindSafe for KeyValidator
impl Send for KeyValidator
impl Sync for KeyValidator
impl Unpin for KeyValidator
impl UnwindSafe for KeyValidator
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self