validator

Trait ValidateLength

Source
pub trait ValidateLength<T>
where T: PartialEq + PartialOrd,
{ // Required method fn length(&self) -> Option<T>; // Provided method fn validate_length( &self, min: Option<T>, max: Option<T>, equal: Option<T>, ) -> bool { ... } }
Expand description

Validates the length of the value given. If the validator has equal set, it will ignore any min and max value.

If you apply it on String, don’t forget that the length can be different from the number of visual characters for Unicode

Required Methods§

Source

fn length(&self) -> Option<T>

Provided Methods§

Source

fn validate_length( &self, min: Option<T>, max: Option<T>, equal: Option<T>, ) -> bool

Implementations on Foreign Types§

Source§

impl ValidateLength<u64> for &str

Source§

fn length(&self) -> Option<u64>

Source§

impl ValidateLength<u64> for str

Source§

fn length(&self) -> Option<u64>

Source§

impl ValidateLength<u64> for String

Source§

fn length(&self) -> Option<u64>

Source§

impl<K, V> ValidateLength<u64> for BTreeMap<K, V>

Source§

fn length(&self) -> Option<u64>

Source§

impl<K, V, S> ValidateLength<u64> for HashMap<K, V, S>

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Cow<'_, T>
where T: ToOwned + ?Sized, for<'a> &'a T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Option<T>
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for &T
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for [T]

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Box<T>
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for BTreeSet<T>

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for VecDeque<T>

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Rc<T>
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Arc<T>
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Vec<T>

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for Ref<'_, T>
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T> ValidateLength<u64> for RefMut<'_, T>
where T: ValidateLength<u64>,

Source§

fn length(&self) -> Option<u64>

Source§

impl<T, S> ValidateLength<u64> for HashSet<T, S>

Source§

fn length(&self) -> Option<u64>

Source§

impl<T, const N: usize> ValidateLength<u64> for [T; N]

Source§

fn length(&self) -> Option<u64>

Implementors§