From beccb7ab3d32cbab9c647ad8d3d67c261dbb9de3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 27 Nov 2015 19:22:21 +0100 Subject: [PATCH] Implement Debug for Configuration --- src/configuration.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/configuration.rs b/src/configuration.rs index 253cb3e4..a4ff2971 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -6,6 +6,10 @@ use std::path::Path; use config::reader::from_file; use config::types::Config as Cfg; +use std::fmt::Debug; +use std::fmt::Formatter; +use std::fmt::Error; + pub struct Configuration { pub rtp : String, pub store_sub : String, @@ -68,3 +72,16 @@ fn fetch_config(rtp: &String) -> Option { 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() + ) + } + +} +