Skip to main content

Validator

Trait Validator 

Source
pub trait Validator: Clone {
    type Err: Error + Send + Sync + 'static;

    // Required method
    fn validate(s: impl AsRef<str>) -> Result<(), Self::Err>;
}
Expand description

Validation trait

Usually it’s implemented by marker type.

Required Associated Types§

Source

type Err: Error + Send + Sync + 'static

Required Methods§

Source

fn validate(s: impl AsRef<str>) -> Result<(), Self::Err>

Validate the string.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Validator for ()

Implementors§