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

Fix: Corrected Display unit mismatch. #86

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

morugetsm
Copy link
Contributor

Updated the documentation to match the actual code behavior.

use bytesize::ByteSize;

fn main() {
    let foo = ByteSize(12345678);

    println!("Default   {}", foo);
    println!("iec       {}", foo.display().iec());
    println!("iec_short {}", foo.display().iec_short());
    println!("si        {}", foo.display().si());
    println!("si_short  {}", foo.display().si_short());
}
Default   11.8 MiB
iec       11.8 MiB
iec_short 11.8M
si        12.3 MB
si_short  12.3M

I arbitrarily changed the numbers to make the difference more noticeable, but feel free to adjust them if there are better values to express it.

Copy link
Member

@robjtede robjtede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one, thank you 👍🏻

@robjtede robjtede enabled auto-merge (squash) March 13, 2025 17:31
@robjtede robjtede merged commit 7467a23 into bytesize-rs:master Mar 13, 2025
11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants