Trait ValidateInput

Source
pub trait ValidateInput: Sized {
    type Error;

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

    // Provided method
    fn into_validated(self) -> Result<Self, Self::Error> { ... }
}
Expand description

Basic trait to validate user defined input.

Required Associated Types§

Source

type Error

The type returned in the event of a validate error.

Required Methods§

Source

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

Perform parameters validation for this configuration and return error if value is inconsistent.

Provided Methods§

Source

fn into_validated(self) -> Result<Self, Self::Error>

The same as validate method, but returns the value itself as a successful result.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§