Struct asciii::config::ConfigReader
[−]
[src]
pub struct ConfigReader { pub path: PathBuf, // some fields omitted }
Looks for a configuration yaml in your HOME_DIR
Fields
path: PathBuf
Path of config file
Methods
impl ConfigReader
[src]
fn path_home() -> PathBuf
[src]
The Path of the config file.
fn new() -> Result<ConfigReader, YamlError>
[src]
Opens config from self.path()
and parses Yaml right away.
fn var_get(path: &str) -> Option<String>
[src]
Looks up path in ENV
Paths are translatet from top/middle/child/node
to ASCIII_TOP_MIDDLE_CHILD_NODE
fn get(&self, path: &str) -> Option<&Yaml>
[src]
Returns whatever it finds in that position
Supports simple path syntax: top/middle/child/node
fn get_char(&self, key: &str) -> Option<char>
[src]
Returns the first character.
Panics
This panics if nothing is found. You should have a default config for everything that you use.
fn get_str_or(&self, key: &str) -> Option<&str>
[src]
Returns the string in the position or an empty string
fn var_get_str(&self, key: &str) -> String
[src]
Returns the string in the position or an empty string
fn get_str(&self, key: &str) -> &str
[src]
Returns the string in the position or an empty string
fn get_strs(&self, key: &str) -> Option<Vec<&str>>
[src]
Returns the a vec of &strs if possible
fn get_to_string(&self, key: &str) -> String
[src]
Returns the string in the position or an empty string
Panics
This panics if nothing is found. You should have a default config for everything that you use.
fn get_f64(&self, key: &str) -> Option<f64>
[src]
Tries to get the config field as float
fn get_bool(&self, key: &str) -> bool
[src]
Returns the boolean in the position or false
Panics
This panics if nothing is found. You should have a default config for everything that you use.