Skip to main content

Validator

Trait Validator 

pub trait Validator<T> {
    type Error;

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

Required Associated Types§

type Error

The associated error type returned by this validator.

Required Methods§

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§

§

impl<T> Validator<T> for ()

§

type Error = Infallible

§

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

Implementors§