chiark / gitweb /
config: Move lookup_raw
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 24 Jul 2021 13:50:47 +0000 (14:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 24 Jul 2021 13:50:47 +0000 (14:50 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/config.rs

index 2d2d9ac4977726ff7ee4ee31604db85cfb358311..491fbe3456b6de327a5ff5b3dfe2ccc32a8661d6 100644 (file)
@@ -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<Item=&'n SectionName>
   {
     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()
     ) {