Repository navigation
Releases
Releases · aleph-im/memsizes
v1.0.0
New Features
- Extended unit coverage: added TiB, PiB, EiB, TB, PB, EB unit types.
- Display implementations for all types (e.g., format!("{}", MiB::from(5)) → "5 MiB").
- Default for all types — defaults to zero.
- Hash derived on Rounding.
- From for u64 on all unit types to extract the raw count.
- Clone, PartialEq, Eq derived on MemConvError.
- #[must_use] on all memory unit types.
Improvements
- MemorySize trait is sealed — prevents external implementations.
- Bytes::to_bytes() is a no-op — returns Ok(self) directly, avoiding a redundant multiply-by-1.
- Full documentation — crate-level docs, #![warn(missing_docs)], doc-tests, and all public items documented.
- Cargo.toml metadata — added keywords and categories for crates.io discoverability.
Breaking Changes
- From for Bytes replaced with TryFrom — converting a unit to Bytes now returns Result<Bytes, MemConvError> instead of panicking on overflow.
- to_exact() returns Result instead of Option — returns Err(MemConvError::Inexact) instead of None.
- units() renamed to count() — applies to all types.
- as_f64() renamed to to_f64() — follows Rust naming conventions.
- from_units() removed — use From instead (e.g., MiB::from(5)).
- Serde is now opt-in — enable with features = ["serde"] in your Cargo.toml.
- New error variant MemConvError::Inexact — replaces the overloaded use of Overflow for non-divisible conversions. ZeroNotAllowed variant removed.
v0.1.0
First release!
Type-safe memory size newtypes for Rust with checked conversions and arithmetic.
Stop mixing up bytes and mebibytes, or accidentally passing a decimal gigabyte where a binary one was expected.
memsizes gives each unit its own type so the compiler catches the mistakes for you.