pub struct ConfigFieldMeta {
pub name: &'static str,
pub type_name: &'static str,
pub env_var: Option<&'static str>,
pub file_key: Option<&'static str>,
pub default: Option<&'static str>,
pub help: Option<&'static str>,
pub required: bool,
pub nested: Option<&'static [ConfigFieldMeta]>,
pub env_prefix: Option<&'static str>,
}Expand description
Metadata about a single field in a Config-implementing struct.
Returned by Config::field_meta for runtime introspection — e.g. to
generate a config file template or validate a user-supplied file.
Fields§
§name: &'static strField name as it appears in the struct.
type_name: &'static strRust type name (best-effort string representation).
env_var: Option<&'static str>Environment variable override from #[param(env = "VAR")].
If None, the macro generates {PREFIX}_{FIELD_UPPER} at load time.
file_key: Option<&'static str>Dotted config-file key override from #[param(file_key = "a.b.c")].
If None, the field name is used directly as the TOML key.
default: Option<&'static str>Default value as a display string (from #[param(default = ...)]).
help: Option<&'static str>Help text from #[param(help = "...")].
required: boolWhether the field is required (no default, not Option<T>).
nested: Option<&'static [ConfigFieldMeta]>For #[param(nested)] fields: metadata of the child struct’s fields.
Some when the field is a nested Config sub-struct; None for
leaf (scalar/Option) fields.
env_prefix: Option<&'static str>Env-var prefix override for nested fields (from #[param(env_prefix = "SEARCH")]).
When Some, child env vars use {env_prefix}_{CHILD_FIELD} instead of
the auto-generated {parent_prefix}_{field_name}_{CHILD_FIELD}.
Only meaningful when nested is Some.
Trait Implementations§
Source§impl Clone for ConfigFieldMeta
impl Clone for ConfigFieldMeta
Source§fn clone(&self) -> ConfigFieldMeta
fn clone(&self) -> ConfigFieldMeta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more