Skip to main content

Validator

Trait Validator 

Source
pub trait Validator<T> {
    type Error;

    // Required method
    fn validate(&self, value: &T) -> Result<(), Self::Error>;
}

Required Associated Types§

Source

type Error

The associated error type returned by this validator.

Required Methods§

Source

fn validate(&self, value: &T) -> Result<(), Self::Error>

Validate a claim value

§Errors

Returns an error if the value is invalid.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T> Validator<T> for ()

Source§

type Error = Infallible

Source§

fn validate(&self, _value: &T) -> Result<(), Self::Error>

Implementors§