Trait Validator

Source
pub trait Validator: Send + Sync {
    // Required methods
    fn validate(&self, input: &str) -> ValidationResult;
    fn partial_validate(
        &self,
        input: &str,
        cursor_pos: usize,
    ) -> PartialValidationResult;
    fn priority(&self) -> Priority;
    fn name(&self) -> &str;

    // Provided method
    fn description(&self) -> &str { ... }
}
Expand description

Core trait for all validators

Required Methods§

Source

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

Validate complete input

Source

fn partial_validate( &self, input: &str, cursor_pos: usize, ) -> PartialValidationResult

Validate partial input during typing

Source

fn priority(&self) -> Priority

Get the priority of this validator

Source

fn name(&self) -> &str

Get the name/identifier of this validator

Provided Methods§

Source

fn description(&self) -> &str

Get human-readable description of this validator

Implementors§