box-convert
English | 简体中文
box-convert provides type conversion utilities, currently featuring a Bytesize type that parses human-readable byte size strings (e.g., "1K2M3B") and formats byte counts back to readable strings.
Features
- Bytesize — human-readable byte size parsing and formatting
- Supports K/M/G suffixes (e.g., "1K", "2M", "3G")
- Combined format parsing (e.g., "1K2M3B")
- Serde support for JSON serialization
From<usize>andFrom<&str>conversions
Cargo Feature Flags
| Feature | Description | Default |
|---|---|---|
bytesize |
Enable the Bytesize type for human-readable byte parsing |
no |
Basic Usage
use Bytesize;
let b = from;
assert_eq!;
let b = from;
assert_eq!;
Tests
8 tests covering From implementations, string formatting, serde roundtrip, and edge cases.
License
Licensed under either of Apache License 2.0 or MIT license at your option.