From: Ian Jackson Date: Sat, 24 Jul 2021 13:42:21 +0000 (+0100) Subject: config X-Git-Tag: hippotat/1.0.0~480 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=39e35b6a740e235d547a70869d50f9ef0b640687;p=hippotat.git config Signed-off-by: Ian Jackson --- diff --git a/macros/macros.rs b/macros/macros.rs index 593f739..51ab23a 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -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 ))] diff --git a/src/config.rs b/src/config.rs index 8308285..8d9d0c8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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::("max_batch_down")?, - } - } -} -*/ - #[throws(AE)] pub fn read() { let opts = config::Opts::from_args();