Skip to main content

Validator

Trait Validator 

Source
pub trait Validator {
    // Required method
    fn validate(&self, input: &str) -> Validation;
}
Expand description

Inspects a candidate answer, accepting it or explaining why it is rejected.

Required Methods§

Source

fn validate(&self, input: &str) -> Validation

Validate input, returning Ok(()) to accept or Err(reason) to reject.

§Errors

Returns the human-readable rejection reason to surface to the user.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> Validator for F
where F: Fn(&str) -> Validation,