summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-05-11 13:37:14 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-05-30 09:39:22 +0200
commit5f5ce54edb90005fedb072356cd5053c9ac5deea (patch)
tree7f5367c5d5bf061e4bacadd328592ee70d4f282e
parentd5eb9185232c0ff015e44106701fcf26b00a18bd (diff)
downloadimag-5f5ce54edb90005fedb072356cd5053c9ac5deea.zip
imag-5f5ce54edb90005fedb072356cd5053c9ac5deea.tar.gz
Rewrite to use derive macro
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--lib/core/libimagrt/src/lib.rs4
-rw-r--r--lib/core/libimagrt/src/logger.rs9
2 files changed, 4 insertions, 9 deletions
diff --git a/lib/core/libimagrt/src/lib.rs b/lib/core/libimagrt/src/lib.rs
index 4247ff6..ebe8f4f 100644
--- a/lib/core/libimagrt/src/lib.rs
+++ b/lib/core/libimagrt/src/lib.rs
@@ -37,17 +37,17 @@
while_true,
)]
-#[macro_use] extern crate log;
+extern crate log;
extern crate itertools;
extern crate ansi_term;
extern crate handlebars;
extern crate serde;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate failure;
+#[macro_use] extern crate toml_query;
extern crate clap;
extern crate toml;
-extern crate toml_query;
extern crate atty;
extern crate libimagstore;
diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs
index e7c0331..ebb9ec4 100644
--- a/lib/core/libimagrt/src/logger.rs
+++ b/lib/core/libimagrt/src/logger.rs
@@ -349,7 +349,6 @@ mod log_lvl_aggregate {
fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Value>)
-> Result<BTreeMap<ModuleName, ModuleSettings>>
{
- use toml_query::read::Partial;
use std::convert::TryInto;
//
@@ -369,14 +368,10 @@ fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Value>)
pub enabled: bool,
}
- #[derive(Serialize, Deserialize, Debug)]
+ #[derive(Partial, Serialize, Deserialize, Debug)]
+ #[location = "imag.logging.modules"]
struct LoggingModuleConfigMap(BTreeMap<String, LoggingModuleConfig>);
- impl<'a> Partial<'a> for LoggingModuleConfigMap {
- const LOCATION: &'static str = "imag.logging.modules";
- type Output = Self;
- }
-
impl TryInto<BTreeMap<String, ModuleSettings>> for LoggingModuleConfigMap {
type Error = Error;