Skip to main content

Configurable

Trait Configurable 

Source
pub trait Configurable {
    // Required method
    fn config(&self) -> &Value;

    // Provided methods
    fn load_config(
        config_file_path: impl AsRef<Path>,
    ) -> Result<Value, ConfigError> { ... }
    fn load_text_file_lines(
        file_path: impl AsRef<Path>,
    ) -> Result<Vec<String>, ConfigError> { ... }
    fn get_config_value(&self, key: &str) -> Option<&Value> { ... }
    fn get_value_recursive<'a>(
        config: &'a Value,
        keys: &[&str],
    ) -> Option<&'a Value> { ... }
}

Required Methods§

Source

fn config(&self) -> &Value

Provided Methods§

Source

fn load_config(config_file_path: impl AsRef<Path>) -> Result<Value, ConfigError>

Source

fn load_text_file_lines( file_path: impl AsRef<Path>, ) -> Result<Vec<String>, ConfigError>

Load Vec<String>`` from file with path file path`

Source

fn get_config_value(&self, key: &str) -> Option<&Value>

Extract Value from config using dot notation i.e. “app.concurrency”

Source

fn get_value_recursive<'a>( config: &'a Value, keys: &[&str], ) -> Option<&'a Value>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§