configbuilder-pattern-builder 0.1.0

configbuilder-pattern: builder domain (ConfigBuilder/BuilderFinalizer), trait contract + tech-agnostic reference implementation.
Documentation
use std::path::PathBuf;

/// Assemble application configuration from named sources.
///
/// `ConfigBuilder` is a **builder-chain trait** -- it covers only the configuration
/// fields (`name`, `version`, `with_config_dir`, `with_config_filename`). It
/// deliberately does **not** include `build_loader()`. That finaliser is an
/// inherent method on the concrete builder types (see
/// `configbuilder-svc-saf`) because the construction logic depends
/// on real filesystem/XDG internals this trait itself must not reference.
pub trait ConfigBuilder: Sized {
    /// Return the configured application name.
    fn name(&self) -> &str;

    /// Return the configured application version.
    fn version(&self) -> &str;

    /// Set the application name; used by `build_loader` to resolve XDG paths.
    fn with_name(self, name: impl Into<String>) -> Self;

    /// Set the application version string.
    fn with_version(self, version: impl Into<String>) -> Self;

    /// Append an explicit config directory; takes precedence over XDG resolution.
    ///
    /// Multiple calls accumulate directories -- later entries win on key conflicts.
    fn with_config_dir(self, dir: impl Into<PathBuf>) -> Self;

    /// Override the config filename searched for in each configured directory.
    ///
    /// Defaults to `application.toml` when not called.
    fn with_config_filename(self, filename: impl Into<String>) -> Self;
}