Implement Debug for Configuration

This commit is contained in:
Matthias Beyer 2015-11-27 19:22:21 +01:00
parent a487fbcaf4
commit beccb7ab3d

View file

@ -6,6 +6,10 @@ use std::path::Path;
use config::reader::from_file; use config::reader::from_file;
use config::types::Config as Cfg; use config::types::Config as Cfg;
use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Error;
pub struct Configuration { pub struct Configuration {
pub rtp : String, pub rtp : String,
pub store_sub : String, pub store_sub : String,
@ -68,3 +72,16 @@ fn fetch_config(rtp: &String) -> Option<Cfg> {
from_file(Path::new(&(rtp.clone() + "/config"))).ok() from_file(Path::new(&(rtp.clone() + "/config"))).ok()
} }
impl Debug for Configuration {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "Configuration (verbose: {}, debugging: {}, rtp: {}, store path: {})",
self.is_verbose(),
self.is_debugging(),
self.get_rtp(),
self.store_path_str()
)
}
}