Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support width configuration in formatcp! #33

Open
iilyak opened this issue Apr 3, 2022 · 2 comments
Open

Support width configuration in formatcp! #33

iilyak opened this issue Apr 3, 2022 · 2 comments

Comments

@iilyak
Copy link

iilyak commented Apr 3, 2022

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 iilyak changed the title Support with configuration in formatcp! Support with configuration in formatcp! Apr 3, 2022
@rodrimati1992
Copy link
Owner

rodrimati1992 commented Apr 3, 2022

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 rodrimati1992 changed the title Support with configuration in formatcp! Support width configuration in formatcp! Apr 3, 2022
@dzfranklin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants