Skip to main content

ExpandVars

Trait ExpandVars 

Source
pub trait ExpandVars {
    // Required method
    fn expand_vars(&mut self) -> Result<(), ExpandVarsError>;
}
Expand description

Trait for types whose String fields can be expanded from environment variables.

Typically derived via #[derive(ExpandVars)] from modkit-macros. Fields marked with #[expand_vars] will have ${VAR} placeholders replaced with the corresponding environment variable values.

§Errors

Returns ExpandVarsError if a referenced environment variable is missing or contains invalid Unicode.

Required Methods§

Source

fn expand_vars(&mut self) -> Result<(), ExpandVarsError>

Expand ${VAR} placeholders in marked fields from environment variables.

§Errors

Returns ExpandVarsError if a referenced environment variable is missing or contains invalid Unicode.

Implementations on Foreign Types§

Source§

impl ExpandVars for String

Source§

impl<K, V, S> ExpandVars for HashMap<K, V, S>
where V: ExpandVars, S: BuildHasher,

Source§

impl<T> ExpandVars for Option<T>
where T: ExpandVars,

Source§

impl<T> ExpandVars for Vec<T>
where T: ExpandVars,

Implementors§