With Rust I can have a user-specified width in my call to format!,
format!("{:>width$}", result.clone(), width=v as usize )
I can even specify the fill character (like the - below)
format!("{:->width$}", result.clone(), width=v as usize )
Or, with a 0,
format!("{:0>width$}", result.clone(), width=v as usize )
But is there a way to have that user-specified? I've tried the following but it doesn't work,
format!("{:fill$>width$}", result.clone(), fill='0' width=v as usize )
I get the following error,
error: invalid format string: expected `'}'`, found `'>'`
--> src/sequence/renderer.rs:124:28
|
124 | |v| Ok(format!("{:fill$>width$}", result.clone(), fill='0', width=v as usize ))
| - ^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: could not compile `letter-sequence` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed