pub fn split_dynamic_string(input: &str) -> Vec<DynamicItem>Expand description
Splits a string into formatting arguments, supporting format specifiers like {var:?}
let s = "hello {a}, {b}{{ {c} }}";
let split = split_dynamic_string(s);
let output = vec![
Str("hello ".to_string()),
Var { name: "a".to_string(), format_spec: None },
Str(", ".to_string()),
Var { name: "b".to_string(), format_spec: None },
Str("{ ".to_string()),
Var { name: "c".to_string(), format_spec: None },
Str(" }".to_string()),
];
assert_eq!(output, split);