Skip to main content

ConfigLoader

Trait ConfigLoader 

Source
pub trait ConfigLoader<T> {
    // Required method
    fn load_layered(
        config_file: Option<PathBuf>,
        env_prefix: &str,
        defaults: T,
    ) -> Result<T, ConfigError>
       where T: DeserializeOwned + Default;
}
Expand description

Base trait for configuration loading with layered approach

Required Methods§

Source

fn load_layered( config_file: Option<PathBuf>, env_prefix: &str, defaults: T, ) -> Result<T, ConfigError>

Load configuration from multiple sources in order of precedence:

  1. Command line arguments (highest priority)
  2. Environment variables
  3. Configuration file
  4. Default values (lowest priority)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§