YmlConfig

Trait YmlConfig 

Source
pub trait YmlConfig<T = HashMap<String, String>>: AbstractConfig<T> {
    // Provided methods
    fn load(target: Option<String>) -> Result<T, Error>
       where T: Default,
             HashMap<String, String>: Into<T>,
             Self: Sized { ... }
    fn load_with_override(
        target: Option<String>,
        excluded_keys: &HashSet<String>,
    ) -> Result<T, Error>
       where T: Default,
             HashMap<String, String>: Into<T>,
             Self: Sized { ... }
}
Expand description

Indicates that structure can be initialized from YAML/YML file.

Provided Methods§

Source

fn load(target: Option<String>) -> Result<T, Error>
where T: Default, HashMap<String, String>: Into<T>, Self: Sized,

Load specified YAML/YML file and initialize the structure.

§Arguments
  • target - Path to the YAML/YML file.
§Errors
  • Error::LoadFileError - If the specified YAML/YML file cannot be loaded or parsed.
Source

fn load_with_override( target: Option<String>, excluded_keys: &HashSet<String>, ) -> Result<T, Error>
where T: Default, HashMap<String, String>: Into<T>, Self: Sized,

Load specified YAML/YML file with explicit control over which keys should not be overridden.

§Arguments
  • target - Path to the YAML/YML file.
  • excluded_keys - Keys that should not be overridden by environment variables.
§Errors
  • Error::LoadFileError - If the specified YAML/YML file cannot be loaded or parsed.

Implementors§