pub fn format_args_dynamic(
input: &str,
variables: &Vec<(String, String)>,
) -> String
Expand description
Given a string and a key => value mapping, replaces parts of the string with the value, i.e.:
let mut variables = vec![
(String::from("a"), String::from("value1")),
(String::from("b"), String::from("value2")),
];
let initial = "hello {a}, {b}{{ {c} }}";
let expected = "hello value1, value2{ {c} }".to_string();
assert_eq!(format_args_dynamic(initial, &variables), expected);
Note: the number (0, 1, etc.) is the order of the argument, it is irrelevant for runtime formatting, only important for keeping the component / function arguments in order when compiling the arguments to Rust code