Skip to main content

ApplyFlatEnv

Trait ApplyFlatEnv 

Source
pub trait ApplyFlatEnv {
    // Required method
    fn apply_flat_env(&mut self, prefix: &str);

    // Provided method
    fn env_var_docs(prefix: &str) -> Vec<EnvVarDoc>
       where Self: Sized { ... }
}
Expand description

Trait for flat environment variable override application.

Implemented by the #[derive(FlatEnvOverrides)] macro, or manually. Each implementation reads {prefix}_{FIELD_NAME} env vars and applies them to the struct fields, overriding values from YAML/figment.

Required Methods§

Source

fn apply_flat_env(&mut self, prefix: &str)

Apply flat environment variable overrides to this config struct.

The prefix is prepended to each field’s suffix to form the full env var name. For nested structs marked with #[env_section], the field name is appended to the prefix before recursing.

Provided Methods§

Source

fn env_var_docs(prefix: &str) -> Vec<EnvVarDoc>
where Self: Sized,

Generate documentation for all supported env vars.

Returns a list of EnvVarDoc entries describing each env var this struct accepts. Used by emit-env-docs CLI subcommands.

Implementors§