const_format_crates icon indicating copy to clipboard operation
const_format_crates copied to clipboard

Support `width` configuration in `formatcp!`

Open iilyak opened this issue 2 years ago • 2 comments

The standard format! macro supports with configuration https://doc.rust-lang.org/std/fmt/index.html#width

I am trying to format 0x0100 using "{:#06x}" however I am getting

failed to parse the format string at the character number 2,
       unknown formatting: "#06x"

When I remove 06 from the format (the resulting format is "{:#x}") I am getting 0x100 which is not what I want.

Is there a way to set with?

iilyak avatar Apr 03 '22 09:04 iilyak

There is no way to set width, don't know how hard it'd be to implement such that it works like in std for all types.

rodrimati1992 avatar Apr 03 '22 17:04 rodrimati1992

In the meantime could you remove the statement "The {}/{:} formatter works the same as in format"? I wasted a while assuming that meant I could pass it the same things as format! before I found this issue.

dzfranklin avatar Oct 09 '22 21:10 dzfranklin