Skip to content

Conversation

@Sheape
Copy link
Contributor

@Sheape Sheape commented Sep 19, 2025

Fixes #87.
This PR adds custom unit conversions for all units that returns as f64. The following new methods are added:

  • as_kb()
  • as_kib()
  • as_mb()
  • as_mib()
  • as_gb()
  • as_gib()
  • as_tb()
  • as_tib()
  • as_pb()
  • as_pib()
  • as_eb()
  • as_eib()

Note that this has a lossy conversion for filesizes larger than 9_007_199_254_740_992 or ~9 PB.

@Sheape Sheape changed the title Add custom unit conversions feat: Add custom unit conversions Sep 19, 2025
@Sheape Sheape changed the title feat: Add custom unit conversions feat: add custom unit conversions Sep 19, 2025
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 thanks 👍🏻

@robjtede robjtede enabled auto-merge (squash) November 10, 2025 03:51
@robjtede robjtede merged commit 4e7d8e1 into bytesize-rs:master Nov 10, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Nov 10, 2025
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.

Feature request: Custom formatting

2 participants