Skip to main content

FieldRule

Trait FieldRule 

Source
pub trait FieldRule<E>: Send + Sync {
    // Required method
    fn validate(&self, entity: &E) -> Vec<ValidationError>;
}
Expand description

A single validation rule applied to an entity.

Implement this to create custom rules beyond the built-ins.

Required Methods§

Source

fn validate(&self, entity: &E) -> Vec<ValidationError>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<E: Send + Sync, F: Fn(&E) -> &str + Send + Sync> FieldRule<E> for MaxLength<E, F>

Source§

impl<E: Send + Sync, F: Fn(&E) -> &str + Send + Sync> FieldRule<E> for Regex<E, F>

Source§

impl<E: Send + Sync, F: Fn(&E) -> &str + Send + Sync> FieldRule<E> for RequiredString<E, F>

Source§

impl<E: Send + Sync, F: Fn(&E) -> &str + Send + Sync> FieldRule<E> for RequiredUuid<E, F>

Source§

impl<E: Send + Sync, F: Fn(&E) -> Option<&str> + Send + Sync> FieldRule<E> for OptionalNotBlank<E, F>

Source§

impl<E: Send + Sync, F: Fn(&E) -> i64 + Send + Sync> FieldRule<E> for NonNegative<E, F>