title: How can I 0-pad a number by a variable amount when formatting with std::fmt?
body: <p>I'm looking to 0-pad a string before I display it to the user, e.g.</p>
  
  <pre><code>let x = 1234;
  println!("{:06}", x); // "001234"
  </code></pre>
  
  <p>However, I'd like the length of the output string to be variable, e.g. it could be set by a command line parameter from the user:</p>
  
  <pre><code>let x = 1234;
  let width = 6;
  println!("{:0*}", width, x); //fails to compile
  // error: invalid format string: expected `'}'`, found `'*'`
  </code></pre>
  
  <p>Unlike precision, it doesn't seem that 0-padding supports the <code>*</code> for specifying a width.</p>
  
  <p>I'm not looking for solutions that involve manually padding, because it seems awkward to re-implement part of <code>std::fmt</code>.</p>