chiark / gitweb /
config derive: Improve and properly document InstanceConfigGlobal
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 19 Mar 2025 18:59:52 +0000 (18:59 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 20 Mar 2025 00:23:06 +0000 (00:23 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
server/server.rs
src/config_derive.rs

index 32d06a7e822cf70960219b1529b6dcc60ee5f96b..568fe6f259f9e5ed4ad05b551b4cd1281cc56f15 100644 (file)
@@ -179,7 +179,7 @@ async fn async_main(opts: Opts, daemon: Option<Daemoniser>) {
       return Ok(None);
     }
 
-    let global_config = config::InstanceConfigGlobal::from(&ics);
+    let global_config = config::InstanceConfigGlobal::from(ics);
     let gc = (&server_name, &global_config);
 
     if pc.keys().all(|k| gc.inspect_key(k).is_some()) {
index fd35ef1e9c127741c4408d8fd1ef547666a4f5a1..0f9322a927aa4598c27bdf0b1d16815688e92dc6 100644 (file)
@@ -54,13 +54,9 @@ define_derive_deftly! {
   ///   }
   /// }
   ///
-  /// pub struct InstanceConfigCommon { ... }
-  /// impl InstanceConfigCommon {
-  ///   pub fn from(l: &[InstanceConfig]) { InstanceConfigCommon {
-  ///     field: <Type as ResolveGlobal>::resolve(l.iter().map(|e| &e.field)),
-  ///     ...
-  ///   } }
-  /// }
+  /// pub struct InstanceConfigGlobal { ... }
+  /// impl InspectableConfigAuto for InstanceConfigGlobal { ... }
+  /// impl From<&'_ [InstanceConfig]> for InstanceConfigGlobal { .. }
   /// ```
 
   InstanceConfig expect items:
@@ -122,8 +118,8 @@ define_derive_deftly! {
     )
   }
 
-  impl InstanceConfigGlobal {
-    pub fn from(l: &[InstanceConfig]) -> InstanceConfigGlobal {
+  impl From<&'_ [InstanceConfig]> for InstanceConfigGlobal {
+    fn from(l: &[InstanceConfig]) -> InstanceConfigGlobal {
       InstanceConfigGlobal {
         $(
           ${when fmeta(global)}