Enhance documentation of configuration module
This commit is contained in:
parent
2beb79581d
commit
f51357279d
1 changed files with 7 additions and 8 deletions
|
@ -36,9 +36,7 @@ generate_error_module!(
|
||||||
|
|
||||||
pub use self::error::{ConfigError, ConfigErrorKind};
|
pub use self::error::{ConfigError, ConfigErrorKind};
|
||||||
|
|
||||||
/**
|
/// Result type of this module. Either `T` or `ConfigError`
|
||||||
* Result type of this module. Either `T` or `ConfigError`
|
|
||||||
*/
|
|
||||||
pub type Result<T> = RResult<T, ConfigError>;
|
pub type Result<T> = RResult<T, ConfigError>;
|
||||||
|
|
||||||
/// `Configuration` object
|
/// `Configuration` object
|
||||||
|
@ -90,15 +88,18 @@ impl Configuration {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the Editor setting from the configuration
|
||||||
pub fn editor(&self) -> Option<&String> {
|
pub fn editor(&self) -> Option<&String> {
|
||||||
self.editor.as_ref()
|
self.editor.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)] // Why do I actually need this annotation on a pub function?
|
#[allow(dead_code)] // Why do I actually need this annotation on a pub function?
|
||||||
|
/// Get the underlying configuration TOML object
|
||||||
pub fn config(&self) -> &Value {
|
pub fn config(&self) -> &Value {
|
||||||
&self.config
|
&self.config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the configuration of the store, if any.
|
||||||
pub fn store_config(&self) -> Option<&Value> {
|
pub fn store_config(&self) -> Option<&Value> {
|
||||||
match self.config {
|
match self.config {
|
||||||
Value::Table(ref tabl) => tabl.get("store"),
|
Value::Table(ref tabl) => tabl.get("store"),
|
||||||
|
@ -208,11 +209,9 @@ fn get_editor_opts(v: &Value) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// Helper to fetch the config file
|
||||||
* Helper to fetch the config file
|
///
|
||||||
*
|
/// Tests several variants for the config file path and uses the first one which works.
|
||||||
* Tests several variants for the config file path and uses the first one which works.
|
|
||||||
*/
|
|
||||||
fn fetch_config(rtp: &PathBuf) -> Result<Value> {
|
fn fetch_config(rtp: &PathBuf) -> Result<Value> {
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
Loading…
Reference in a new issue