Skip to main content

Resolvable

Trait 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 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

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)

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> 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> 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]),

Implementors§

Source§

impl<T> Resolvable for T
where T: TopLevel, T::Builder: Builder<Built = Self> + ConfigBuilder + Clone + Serialize,