Trait tor_config::load::Resolvable
source · pub trait Resolvable: Sized {
// Required methods
fn resolve(input: &mut ResolveContext) -> Result<Self, ConfigResolveError>;
fn enumerate_deprecated_keys<F>(f: &mut F)
where F: FnMut(&'static [&'static str]);
}
Expand description
Collection of configuration settings that can be deserialized and then built
Do not implement directly.
Instead, implement TopLevel
: doing so engages the blanket impl
for (loosely) TopLevel + Builder
.
Each Resolvable
corresponds to one or more configuration consumers.
Ultimately, one Resolvable
for all the configuration consumers in an entire
program will be resolved from a single configuration tree (usually parsed from TOML).
Multiple config collections can be resolved from the same configuration,
via the implementation of Resolvable
on tuples of Resolvable
s.
Use this rather than #[serde(flatten)]
; the latter prevents useful introspection
(necessary for reporting unrecognized configuration keys, and testing).
(The resolve
method will be called only from within the tor_config::load
module.)
Required Methods§
sourcefn resolve(input: &mut ResolveContext) -> Result<Self, ConfigResolveError>
fn resolve(input: &mut ResolveContext) -> Result<Self, ConfigResolveError>
Deserialize and build from a configuration
sourcefn enumerate_deprecated_keys<F>(f: &mut F)where
F: FnMut(&'static [&'static str]),
fn enumerate_deprecated_keys<F>(f: &mut F)where F: FnMut(&'static [&'static str]),
Return a list of deprecated config keys, as “.”-separated strings