I haven't found anything similar in Rust. Has anything similar been considered yet? Would it be a useful feature? Is it worth writing an RFC for?
Example:
let my_variable=42;
// Current
println!("my_variable={my_variable}");
println!("my_variable={my_variable:05}");
// Proposed
println!("{my_variable=}");
println!("{my_variable=:05}");
To answer your original question, I personally wouldn't make the effort to write an RFC for something like this. I don't think its impossible that it could be added to Rust (after all, we recently got the {var_name} syntax), but my guess is that it would be difficult to garner enough support to add it.
You know what, I think this would actually be a nice addition. I know dbg! exists, but I often want to format multiple things on a line, or keep them in a compact format. I've probably written a "dump multiple variables" macro more than a dozen times. Since format strings are expanded at compile time, there shouldn't be any runtime overhead to supporting it.
I can't really think of a downside. Might make a good first contribution.
FWIW, a quick and dirty way to print multiple values on the same line with dbg! is to pass them in a tuple: dbg!((foo, 42, bar(1.23))) (and for those who don’t know, note that dbg! can already take multiple parameters but prints them on separate lines, still can be handy).