TracedConfig

Struct TracedConfig 

Source
pub struct TracedConfig<T> { /* private fields */ }
Expand description

Configuration with tracing information.

This type wraps a Config<T> with additional trace data that shows where each configuration value came from and its override history.

Implementations§

Source§

impl<T> TracedConfig<T>

Source

pub fn new(config: Config<T>, traces: BTreeMap<String, ValueTrace>) -> Self

Create a new traced config from a config and traces.

Source

pub fn value(&self) -> &T

Get reference to the configuration.

Source

pub fn config(&self) -> &Config<T>

Get reference to the inner Config.

Source

pub fn into_inner(self) -> T

Consume and return the configuration value.

Source

pub fn into_config(self) -> Config<T>

Consume and return the inner Config.

Source

pub fn trace(&self, path: &str) -> Option<&ValueTrace>

Get the trace for a specific path.

Source

pub fn was_overridden(&self, path: &str) -> bool

Check if a path was overridden by a higher-priority source.

Source

pub fn traces(&self) -> impl Iterator<Item = (&str, &ValueTrace)>

Get all traces.

Source

pub fn overridden_paths(&self) -> impl Iterator<Item = &str>

Get paths that were overridden.

Source

pub fn paths(&self) -> impl Iterator<Item = &str>

Get all traced paths.

Source

pub fn trace_count(&self) -> usize

Get the number of traced paths.

Source

pub fn trace_report(&self) -> String

Generate a human-readable trace report.

Trait Implementations§

Source§

impl<T> AsRef<T> for TracedConfig<T>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Debug> Debug for TracedConfig<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for TracedConfig<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<T> Freeze for TracedConfig<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TracedConfig<T>
where T: RefUnwindSafe,

§

impl<T> Send for TracedConfig<T>
where T: Send,

§

impl<T> Sync for TracedConfig<T>
where T: Sync,

§

impl<T> Unpin for TracedConfig<T>
where T: Unpin,

§

impl<T> UnwindSafe for TracedConfig<T>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.