[][src]Trait dialoguer::Validator

pub trait Validator<T> {
    type Err: Debug + Display;
    fn validate(&self, input: &T) -> Result<(), Self::Err>;
}

Trait for input validators.

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

Associated Types

type Err: Debug + Display

Loading content...

Required methods

fn validate(&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.

Loading content...

Implementors

impl<T, F: Fn(&T) -> Result<(), E>, E: Debug + Display> Validator<T> for F[src]

type Err = E

Loading content...