Struct fog_pack::validator::KeyValidator [−][src]
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
impl KeyValidator[src]
pub fn new() -> Self[src]
Make a new validator with the default configuration.
pub fn matches(self, matches: Regex) -> Self[src]
Set the regular expression to check against.
pub fn normalize(self, normalize: Normalize) -> Self[src]
Set the unicode normalization form to use for in, nin, and matches checks.
pub fn max_len(self, max_len: u32) -> Self[src]
Set the maximum number of allowed bytes.
pub fn min_len(self, min_len: u32) -> Self[src]
Set the minimum number of allowed bytes.
Trait Implementations
impl Clone for KeyValidator[src]
fn clone(&self) -> KeyValidator[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for KeyValidator[src]
impl Default for KeyValidator[src]
impl<'de> Deserialize<'de> for KeyValidator where
KeyValidator: Default, [src]
KeyValidator: Default,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl PartialEq<KeyValidator> for KeyValidator[src]
impl Serialize for KeyValidator[src]
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
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,