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§
Provided Methods§
fn load_config(config_file_path: impl AsRef<Path>) -> Result<Value, Error>
Sourcefn load_text_file_lines(
file_path: impl AsRef<Path>,
) -> Result<Vec<String>, Error>
fn load_text_file_lines( file_path: impl AsRef<Path>, ) -> Result<Vec<String>, Error>
Load Vecfile path
fn load_text_file_content(file_path: impl AsRef<Path>) -> Result<String, Error>
Sourcefn get_config_value(&self, key: &str) -> Option<&Value>
fn get_config_value(&self, key: &str) -> Option<&Value>
Extract Value from config using dot notation i.e. “app.concurrency”
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.