Skip to main content

substitute

Function substitute 

Source
pub fn substitute(template: &str, values: &HashMap<&str, String>) -> String
Expand description

Substitute every {key} in template with values[key]. Unknown keys are left as-is.

This is a single-pass scan; an O(N) implementation that does no re-substitution. (Avoids the bash pitfall where replacement text containing {foo} would get further substituted.)