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, Error> { ... }
    fn load_text_file_lines(
        file_path: impl AsRef<Path>,
    ) -> Result<Vec<String>, Error> { ... }
    fn load_text_file_content(
        file_path: impl AsRef<Path>,
    ) -> Result<String, Error> { ... }
    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, Error>

Source

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

Load Vec from file with path file path

Source

fn load_text_file_content(file_path: impl AsRef<Path>) -> Result<String, Error>

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", so this trait is not object safe.

Implementors§