summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-04-27 01:21:48 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-05-30 09:32:07 +0200
commita3f771ca65be082331fa69e8e7fcb97d9b1b33fb (patch)
tree3700a81b9b69a0bbe385dc5765d46e73b7864c09
parentfb8b50fa9a75b50becf9576c22f0041f9b551fea (diff)
downloadimag-a3f771ca65be082331fa69e8e7fcb97d9b1b33fb.zip
imag-a3f771ca65be082331fa69e8e7fcb97d9b1b33fb.tar.gz
Add comment why we do this
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--lib/core/libimagrt/src/logger.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs
index 956d251..e7c0331 100644
--- a/lib/core/libimagrt/src/logger.rs
+++ b/lib/core/libimagrt/src/logger.rs
@@ -352,6 +352,16 @@ fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Value>)
use toml_query::read::Partial;
use std::convert::TryInto;
+ //
+ // We define helper types here for deserializing easily using typed toml-query functionality.
+ //
+ // We need the helper types because we cannot deserialize in the target types directly, because
+ // of the `File(Arc<Mutex<::std::fs::File>>)` variant in `LogDestination`, which would
+ // technically possible to deserialize the toml into the type, but it might be a bad idea.
+ //
+ // This code is idomatic enough for the conversions, so it is not a big painpoint.
+ //
+
#[derive(Serialize, Deserialize, Debug)]
struct LoggingModuleConfig {
pub destinations: Option<Vec<String>>,
@@ -382,7 +392,7 @@ fn aggregate_module_settings(_matches: &ArgMatches, config: Option<&Value>)
Some(ds) => Some(ds
.iter()
.map(Deref::deref)
- .map(translate_destination)
+ .map(translate_destination) // This is why we do this whole thing
.collect::<Result<Vec<LogDestination>>>()?)
},
});