From d55f1e0974bba6596d25cea0e8788238274c2485 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 24 Jul 2021 14:50:47 +0100 Subject: [PATCH] config: Move lookup_raw Signed-off-by: Ian Jackson --- src/config.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2d2d9ac..491fbe3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -371,13 +371,13 @@ impl SectionKindList { } } -impl<'c> ResolveContext<'c> { +impl Aggregate { fn lookup_raw<'n, S>(&self, key: &'static str, sections: S) - -> Option<&'c RawVal> + -> Option<&RawVal> where S: Iterator { for section in sections { - if let Some(raw) = self.agg.sections + if let Some(raw) = self.sections .get(section) .and_then(|vars: &SectionMap| vars.get(key)) { @@ -386,10 +386,12 @@ impl<'c> ResolveContext<'c> { } None } +} +impl<'c> ResolveContext<'c> { fn first_of_raw(&self, key: &'static str, sections: SectionKindList) -> Option<&'c RawVal> { - self.lookup_raw( + self.agg.lookup_raw( key, self.all_sections.iter() .filter(|s| sections.contains(s)) @@ -464,7 +466,7 @@ impl<'c> ResolveContext<'c> { #[throws(AE)] pub fn special_server(&self, key: &'static str) -> ServerName { - let raw = match self.lookup_raw( + let raw = match self.agg.lookup_raw( "server", [ &SectionName::Common, &self.special_server_section ].iter().cloned() ) { -- 2.30.2