I have a very simple program:
fn main() { let y = format!("{:0>3}", 11); println!("{}", y); } The output is the string 011. The problem is that the width specifier 3 in {:0>3} is coming from a variable like this:
fn main() { let x = 3usize; let y = format!("{:0>3}", 11); println!("{}", y); } How can I use variable x to replace 3 in {:0>3}?