Skip to main content

fill

Function fill 

Source
pub fn fill(
    text: &str,
    args: &[(&str, &dyn Display)],
    lookup: impl Fn(&str) -> Option<String>,
) -> String
Expand description

text with each {name} replaced by its value in args, else by what lookup gives for it, else left as written. What is filled in is not looked at again, so a value may hold braces. An unclosed { and what follows it are plain text.

What lookup gives (a key’s name, Left Shift) is kept on one line: its spaces become NO_BREAK_SPACEs, which word_wrap never breaks at and a glyph buffer draws as spaces.