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 Resolvables. 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§

source

fn resolve(input: &mut ResolveContext) -> Result<Self, ConfigResolveError>

Deserialize and build from a configuration

source

fn enumerate_deprecated_keys<F>(f: &mut F)where F: FnMut(&'static [&'static str]),

Return a list of deprecated config keys, as “.”-separated strings

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<A> Resolvable for (A,)where A: Resolvable,

source§

fn resolve(cfg: &mut ResolveContext) -> Result<Self, ConfigResolveError>

source§

fn enumerate_deprecated_keys<NF>(f: &mut NF)where NF: FnMut(&'static [&'static str]),

source§

impl<A, B> Resolvable for (A, B)where A: Resolvable, B: Resolvable,

source§

fn resolve(cfg: &mut ResolveContext) -> Result<Self, ConfigResolveError>

source§

fn enumerate_deprecated_keys<NF>(f: &mut NF)where NF: FnMut(&'static [&'static str]),

source§

impl<A, B, C> Resolvable for (A, B, C)where A: Resolvable, B: Resolvable, C: Resolvable,

source§

fn resolve(cfg: &mut ResolveContext) -> Result<Self, ConfigResolveError>

source§

fn enumerate_deprecated_keys<NF>(f: &mut NF)where NF: FnMut(&'static [&'static str]),

source§

impl<A, B, C, D> Resolvable for (A, B, C, D)where A: Resolvable, B: Resolvable, C: Resolvable, D: Resolvable,

source§

fn resolve(cfg: &mut ResolveContext) -> Result<Self, ConfigResolveError>

source§

fn enumerate_deprecated_keys<NF>(f: &mut NF)where NF: FnMut(&'static [&'static str]),

source§

impl<A, B, C, D, E> Resolvable for (A, B, C, D, E)where A: Resolvable, B: Resolvable, C: Resolvable, D: Resolvable, E: Resolvable,

source§

fn resolve(cfg: &mut ResolveContext) -> Result<Self, ConfigResolveError>

source§

fn enumerate_deprecated_keys<NF>(f: &mut NF)where NF: FnMut(&'static [&'static str]),

Implementors§

source§

impl<T> Resolvable for Twhere T: TopLevel, T::Builder: Builder<Built = Self>,