SourceFormatter

Trait SourceFormatter 

Source
pub trait SourceFormatter<'a, TValue> {
    // Required method
    fn get_source_value(&'a self) -> TValue;
}
Expand description

SourceFormatter is a public interface / trait that must be implemented by all source value.

Before this trait exists, the formatter value by default is String. The problem begins when we’re try to use other format like std::env::vars() that give us an iterator of key and value in string.

That’s why rather than depends on single hardcoded value (String), it will be better to design the config value itself based on this trait.

Required Methods§

Source

fn get_source_value(&'a self) -> TValue

Implementors§

Source§

impl<'a> SourceFormatter<'a, String> for rstdev_config::values::StringValue

Source§

impl<'a> SourceFormatter<'a, Vec<(String, String)>> for rstdev_config::values::TupleValue