diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-02 16:01:15 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-02 16:01:15 +0200 |
commit | cc0a4ede6f4c46e4857812dce0ecb291738505b3 (patch) | |
tree | 5ddb1b7d743a123d88d8b5f0fe80d7db18b86d80 | |
parent | ed1808a9be40210b4d4d3e304f2582a7883b3211 (diff) |
Impl AsConfig for Option<_>feature/add_tedge_api_only/config-option
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | crates/core/tedge_api/src/config.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/core/tedge_api/src/config.rs b/crates/core/tedge_api/src/config.rs index c7c4b47c..4b4dc316 100644 --- a/crates/core/tedge_api/src/config.rs +++ b/crates/core/tedge_api/src/config.rs @@ -151,6 +151,16 @@ impl<V: AsConfig> AsConfig for HashMap<String, V> { } } +impl<V: AsConfig> AsConfig for Option<V> { + fn as_config() -> ConfigDescription { + ConfigDescription::new( + format!("'{}', optional", V::as_config().name()), + ConfigKind::Wrapped(Box::new(V::as_config())), + None, + ) + } +} + macro_rules! impl_config_kind { ($kind:expr; $name:expr; $doc:expr => $($typ:ty),+) => { $( |