pub fn substitute<'a, 'b>(
s: &'a str,
vars: &'b HashMap<&'b str, &'b str>,
used_vars: &mut HashSet<String>,
max_recursion_depth: u8,
) -> Option<String>
Expand description
Given a map of key/value pairs, perform variable substitution on a given
input string. max_recursion_depth
controls the maximum allowed recursion
depth if variables refer to other strings themselves containing variable
references. A small number but reasonable is recommended by default, e.g.
16.
If None is returned, substitution was impossible, either because a
referenced variable did not exist, or recursion depth was exceeded.