• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    20
    ·
    edit-2
    9 months ago

    You must’ve read that wrong.

    The first example, but formatted differently:

    let value = "My name is Rho.";
    let result = unformat!("My {} is {}.", value);
    

    Now, result contains:

    Some(("name", "Rho"))
    

    …because the words “name” and “Rho” in value happened to be at the position of the {}-slots in the unformat!()-pattern.