From 41019ca9b4c2e08c2b11e9fe65f3d1f50d9bb718 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 18 May 2023 16:04:47 +0200 Subject: [PATCH 1/2] Add Layers::iter() Signed-off-by: Matthias Beyer --- src/config/layers.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config/layers.rs b/src/config/layers.rs index c84a516..f209789 100644 --- a/src/config/layers.rs +++ b/src/config/layers.rs @@ -121,4 +121,15 @@ impl Layers { Ok(None) } + + /// Iterate over the individual layers + /// + /// This function returns an iterator that can be used to iterate over the individual layers of + /// the configuration. + /// + /// This is useful if you want to access all values of each layer (even the shadowed ones) for + /// example for debug analysis of the loaded configuration values. + pub fn iter(&self) -> impl Iterator { + self.0.iter() + } } From 87aff015975e3b059926012946c2ddd7a88d032a Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 18 May 2023 16:05:45 +0200 Subject: [PATCH 2/2] Add ConfigObject::element() getter Signed-off-by: Matthias Beyer --- src/object/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/object/mod.rs b/src/object/mod.rs index 847dc92..19fe484 100644 --- a/src/object/mod.rs +++ b/src/object/mod.rs @@ -50,6 +50,11 @@ impl ConfigObject { Ok(None) } } + + /// Get the configuration element that the object wraps + pub fn element(&self) -> &dyn ConfigElement { + &*self.element + } } #[derive(Debug, thiserror::Error)]