pub trait InputValidator<T> {
    type Err;

    // Required method
    fn validate(&mut self, input: &T) -> Result<(), Self::Err>;
}
Expand description

Trait for input validators.

A generic implementation for Fn(&str) -> Result<(), E> is provided to facilitate development.

Required Associated Types§

Required Methods§

source

fn validate(&mut self, input: &T) -> Result<(), Self::Err>

Invoked with the value to validate.

If this produces Ok(()) then the value is used and parsed, if an error is returned validation fails with that error.

Implementors§

source§

impl<T, F, E> InputValidator<T> for Fwhere F: FnMut(&T) -> Result<(), E>,

§

type Err = E