tier 0.1.17

Rust configuration library for layered TOML, env, and CLI settings
Documentation
use crate::{ConfigReport, LoadedConfig};

use super::ReloadHandle;
use super::sync::read_lock;

impl<T> ReloadHandle<T>
where
    T: Clone + Send + Sync + 'static,
{
    /// Returns a full snapshot of the current loaded configuration and report.
    #[must_use]
    pub fn snapshot(&self) -> LoadedConfig<T> {
        read_lock(&self.state).clone()
    }

    /// Returns a cloned copy of the current configuration value.
    #[must_use]
    pub fn config(&self) -> T {
        read_lock(&self.state).config().clone()
    }

    /// Returns a cloned copy of the current configuration report.
    #[must_use]
    pub fn report(&self) -> ConfigReport {
        read_lock(&self.state).report().clone()
    }
}