From a487fbcaf4a50664a2efeccf1df9304b0554e450 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 27 Nov 2015 19:18:38 +0100 Subject: [PATCH] Implement Debug for CliConfig --- src/cli.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index 27ac1f3b..2a4f25bc 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,6 +1,10 @@ extern crate clap; use clap::{App, ArgMatches}; +use std::fmt::Debug; +use std::fmt::Formatter; +use std::fmt::Error; + pub struct ModuleConfig { pub load : bool, } @@ -39,3 +43,13 @@ impl<'a> CliConfig<'a> { } } +impl<'a> Debug for CliConfig<'a> { + + fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { + write!(f, "CliConfig (verbose: {}, debugging: {}, rtp: {})", + self.is_verbose(), + self.is_debugging(), + self.get_rtp().or(Some(String::from("NONE"))).unwrap()) + } + +}