configbuilder-pattern-loader 0.1.0

configbuilder-pattern: loader domain, trait contract + tech-agnostic reference implementation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{ConfigError, RawFeature};

/// Type-erased view of a config source used internally by [`crate::DefaultLoader`].
///
/// Non-generic so it can be boxed as a trait object. All deserialization of
/// the returned `toml::Value` is performed by the caller.
pub trait LoaderOps: Send + Sync {
    /// Load the raw merged TOML value at `key` from all configured directories.
    fn load_section_value(&self, key: &str) -> Result<toml::Value, ConfigError>;

    /// Validate all configured directories.
    fn validate_dirs(&self) -> Result<(), ConfigError>;

    /// Load the raw feature data for `key`.
    fn load_feature_raw(&self, key: &str) -> Result<RawFeature, ConfigError>;
}