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

index 593f7398e39118ccbcf040685ce805a32807a2cc..51ab23a67c256e7617abb5515083f2c61e6b672b 100644 (file)
@@ -12,10 +12,31 @@ use proc_macro2::{Literal, TokenStream};
 
 use itertools::Itertools;
 
+/// Generates config resolver method
+/// 
 /// Atrributes:
 ///
-///  * `limited`, `server`, `client`: cooked sets of settings
+///  * `limited`, `server`, `client`: cooked sets of settings;
+///    default `SKL` is `Ordinary` except for `limited`
 ///  * `special(method, SKL)`
+///
+/// Generated code
+///
+/// ```no_run
+/// impl<'c> ResolveContext<'c> {
+///
+///   const FIELDS: &'static [(&'static str, SectionKindList)] = &[ ... ];
+///
+///   #[throws(AE)]
+///   fn resolve_instance(&self) -> InstanceConfig {
+///     InstanceConfig {
+///       ...
+///        max_batch_down: self.limited("max_batch_down")?,
+///        ...
+///      }
+///   }
+/// }
+/// ```
 #[proc_macro_derive(ResolveConfig, attributes(
   limited, server, client, special
 ))]
index 830828573b4967baad5760b6421762f5eb3ae3e7..8d9d0c824a39b2e9e82d48f1bc297454c5cc3183 100644 (file)
@@ -477,17 +477,6 @@ impl<'c> ResolveContext<'c> {
   }
 }
 
-/*
-impl<'c> ResolveContext<'c> {
-  #[throws(AE)]
-  fn resolve_instance(&self) -> InstanceConfig {
-    InstanceConfig {
-      max_batch_down: self.limited::<u32>("max_batch_down")?,
-    }
-  }
-}
-*/
-
 #[throws(AE)]
 pub fn read() {
   let opts = config::Opts::from_args();