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

Utilize # specifier to implement Display trait for SI unit #24

Open
EFanZh opened this issue Apr 11, 2021 · 4 comments
Open

Utilize # specifier to implement Display trait for SI unit #24

EFanZh opened this issue Apr 11, 2021 · 4 comments
Labels
Milestone

Comments

@EFanZh
Copy link

EFanZh commented Apr 11, 2021

So that it is possible to use {} for decimal units (KB, MB, GB), and {:#} for binary units (KiB, MiB, GiB).

@wookietreiber
Copy link

This seems rather ad-hoc to me. I would prefer explicitly naming the unit rather than having this be done ad-hoc with formatting specifiers.

@loyd
Copy link

loyd commented Apr 18, 2023

KB by default looks strange to me. Never have I met a programmer thinking in decimal units instead of binary units.

@MrCroxx
Copy link
Collaborator

MrCroxx commented Sep 10, 2024

KB by default looks strange to me. Never have I met a programmer thinking in decimal units instead of binary units.

+1 for this.

Seem the repo is not maintained for some time. I forked this repo to https://github.com/foyer-rs/bytesize and made some differences.

Differences from the original bytesize

  • Use SI format by default with Display.
  • Use "KiB" for SI unit.

Considering the changes, the version of foyer-bytesize crate starts from "2" to differ from the original bytesize crate.

FYI: https://github.com/foyer-rs/bytesize#differences-from-the-original-bytesize

If you need the features, you can use foyer-bytesize as:

bytesize = { package = "foyer-bytesize", version = "2", features = ["serde"]}

And I'm happy to either help to maintain the repo, or contribute back to the upstream if the author is still maintaining this repo.

@MrCroxx MrCroxx added this to the 2.0 milestone Nov 18, 2024
@MrCroxx MrCroxx added the Q & A label Nov 18, 2024
@MrCroxx
Copy link
Collaborator

MrCroxx commented Nov 18, 2024

Hi, folks. I am currently responsible for advancing the development of bytesize with two other developers. In the next release version, bytesize will use IEC units by default.

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

No branches or pull requests

4 participants