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]
impl ConfigReader
pub fn path_home() -> PathBuf
[src]
pub fn path_home() -> PathBuf
The Path of the config file.
pub fn new() -> Result<ConfigReader, YamlError>
[src]
pub fn new() -> Result<ConfigReader, YamlError>
Opens config from self.path()
and parses Yaml right away.
pub fn var_get(path: &str) -> Option<String>
[src]
pub fn var_get(path: &str) -> Option<String>
Looks up path in ENV
Paths are translatet from top/middle/child/node
to ASCIII_TOP_MIDDLE_CHILD_NODE
pub fn get(&self, path: &str) -> Option<&Yaml>
[src]
pub fn get(&self, path: &str) -> Option<&Yaml>
Returns whatever it finds in that position
Supports simple path syntax: top/middle/child/node
pub fn get_char(&self, key: &str) -> Option<char>
[src]
pub fn get_char(&self, key: &str) -> Option<char>
Returns the first character.
Panics
This panics if nothing is found. You should have a default config for everything that you use.
pub fn get_str_or(&self, key: &str) -> Option<&str>
[src]
pub fn get_str_or(&self, key: &str) -> Option<&str>
Returns the string in the position or an empty string
pub fn var_get_str(&self, key: &str) -> String
[src]
pub fn var_get_str(&self, key: &str) -> String
Returns the string in the position or an empty string
pub fn get_str(&self, key: &str) -> &str
[src]
pub fn get_str(&self, key: &str) -> &str
Returns the string in the position or an empty string
pub fn get_strs(&self, key: &str) -> Option<Vec<&str>>
[src]
pub fn get_strs(&self, key: &str) -> Option<Vec<&str>>
Returns the a vec of &strs if possible
pub fn get_to_string(&self, key: &str) -> String
[src]
pub fn get_to_string(&self, key: &str) -> String
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.
pub fn get_f64(&self, key: &str) -> Option<f64>
[src]
pub fn get_f64(&self, key: &str) -> Option<f64>
Tries to get the config field as float
pub fn get_bool(&self, key: &str) -> bool
[src]
pub fn get_bool(&self, key: &str) -> bool
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.
Trait Implementations
impl Debug for ConfigReader
[src]
impl Debug for ConfigReader
Auto Trait Implementations
impl Send for ConfigReader
impl Send for ConfigReader
impl Sync for ConfigReader
impl Sync for ConfigReader