Memory Size
MemorySize is a Rust library for representing a number of bits or bytes. It provides utilities for working with memory sizes in bytes and bits, as well as performing arithmetic operations, comparisons, and formatting.
Features
- Create memory sizes from bytes or bits.
- Perform arithmetic operations (
+,-,+=,-=) on memory sizes. - Compare memory sizes using
PartialOrdandOrd. - Pretty-print memory sizes in human-readable formats (e.g.
10 kB,1 GB). - Clamp, find the maximum, or find the minimum of memory sizes.
- Sum memory sizes from iterators.
Example
use MemorySize;
Testing
To run the testing scripts, use: