pub struct ArrayValidators;Expand description
Array validators implementation
Implementationsยง
Sourceยงimpl ArrayValidators
impl ArrayValidators
Sourcepub fn min_length(value: &FieldValue, min: usize) -> Result<(), String>
pub fn min_length(value: &FieldValue, min: usize) -> Result<(), String>
Validate minimum array length
Sourcepub fn max_length(value: &FieldValue, max: usize) -> Result<(), String>
pub fn max_length(value: &FieldValue, max: usize) -> Result<(), String>
Validate maximum array length
Sourcepub fn exact_length(value: &FieldValue, exact: usize) -> Result<(), String>
pub fn exact_length(value: &FieldValue, exact: usize) -> Result<(), String>
Validate exact array length
Sourcepub fn length_range(
value: &FieldValue,
min: usize,
max: usize,
) -> Result<(), String>
pub fn length_range( value: &FieldValue, min: usize, max: usize, ) -> Result<(), String>
Validate array length range
Sourcepub fn all_items_not_empty(value: &FieldValue) -> Result<(), String>
pub fn all_items_not_empty(value: &FieldValue) -> Result<(), String>
Validate that all array items are not empty
Sourcepub fn all_items_unique(value: &FieldValue) -> Result<(), String>
pub fn all_items_unique(value: &FieldValue) -> Result<(), String>
Validate that all array items are unique
Sourcepub fn all_items_strings(value: &FieldValue) -> Result<(), String>
pub fn all_items_strings(value: &FieldValue) -> Result<(), String>
Validate that all array items are strings
Sourcepub fn all_items_numbers(value: &FieldValue) -> Result<(), String>
pub fn all_items_numbers(value: &FieldValue) -> Result<(), String>
Validate that all array items are numbers
Sourcepub fn all_items_booleans(value: &FieldValue) -> Result<(), String>
pub fn all_items_booleans(value: &FieldValue) -> Result<(), String>
Validate that all array items are booleans
Sourcepub fn validate_items_with<F>(
value: &FieldValue,
validator: F,
) -> Result<(), String>
pub fn validate_items_with<F>( value: &FieldValue, validator: F, ) -> Result<(), String>
Validate array items against a custom validator function
Sourcepub fn contains<F>(value: &FieldValue, predicate: F) -> Result<(), String>
pub fn contains<F>(value: &FieldValue, predicate: F) -> Result<(), String>
Validate that array contains at least one item matching a condition
Sourcepub fn contains_none<F>(value: &FieldValue, predicate: F) -> Result<(), String>
pub fn contains_none<F>(value: &FieldValue, predicate: F) -> Result<(), String>
Validate that array contains no items matching a condition
Auto Trait Implementationsยง
impl Freeze for ArrayValidators
impl RefUnwindSafe for ArrayValidators
impl Send for ArrayValidators
impl Sync for ArrayValidators
impl Unpin for ArrayValidators
impl UnsafeUnpin for ArrayValidators
impl UnwindSafe for ArrayValidators
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
Sourceยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Sourceยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Sourceยงfn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.