Skip to main content

Validator

Trait Validator 

Source
pub trait Validator {
    // Required method
    fn validate_path(&self, target: &Path) -> Result<(), ValidatorError>;
}
Expand description

Validates a filesystem path before it is used as a config directory.

The reference implementation is crate::DefaultValidator. Import this trait only when writing generic code that accepts any validator.

Required Methods§

Source

fn validate_path(&self, target: &Path) -> Result<(), ValidatorError>

Returns Ok(()) when target is a valid config directory path, Err otherwise.

A non-existent path is considered valid (it will be skipped at load time). A path that exists but is not a directory returns ValidatorError::Io.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§