Skip to content

v0.2.0 group size now supports numbers

Choose a tag to compare

@PeterCullenBurbery PeterCullenBurbery released this 01 Oct 21:54
· 4 commits to main since this release

[0.2.0] - 2025_010_001_017_050_016_216531100_America_slash_New_York_2025_W040_003_2025_274_1759355416_216531100

Added

  • Extended format_number() to accept both &str and usize for the group_size argument:
    • format_number("12345", "") → "012_345"
    • format_number("12345", "4") → "0001_2345"
    • format_number("12345", 4) → "0001_2345"
  • Introduced IntoGroupSize trait internally to unify conversion from &str and usize into a validated group size.
  • Added panic safety: group_size = 0 (either as "0" or 0) will cause a clear panic "group_size must be positive".

Tests

  • Expanded tests to cover:
    • Using &str group sizes.
    • Using usize group sizes.
    • Panic conditions for 0.
    • Negative numbers and decimals.