configulator-rs 0.1.2

A configuration loader that populates a struct from config files, environment variables, and CLI flags
Documentation
/// Describes a field's structural shape for runtime source loading.
/// The actual type parsing is handled by the derive macro via `FromStr`.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum FieldType {
    /// A boolean field (special-cased for CLI flags that take no value).
    Bool,
    /// Any scalar type that implements `FromStr`.
    Scalar,
    /// A `Vec<T>` where T implements `FromStr`.
    List,
    /// A nested struct that derives `Config`.
    Struct(Vec<FieldInfo>),
}

/// Metadata about a single config struct field, generated by the derive macro.
#[derive(Debug, Clone, PartialEq)]
pub struct FieldInfo {
    /// The Rust field name (e.g. `max_connections`).
    pub field_name: &'static str,
    /// The config key name from the `name` attribute (e.g. `max-connections`).
    pub config_name: &'static str,
    /// Default value as a string, if specified.
    pub default_value: Option<&'static str>,
    /// Description for CLI help text.
    pub description: Option<&'static str>,
    /// The field's structural type.
    pub field_type: FieldType,
}