Trait validator::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§