| Crates.io | memory_size |
| lib.rs | memory_size |
| version | 0.1.2 |
| created_at | 2025-04-15 15:56:56.093276+00 |
| updated_at | 2025-09-07 21:38:22.959323+00 |
| description | A crate with the ability to represent a number of bits or bytes, and apply arithmetic to the sizes |
| homepage | |
| repository | https://github.com/trauts1234/MemorySize |
| max_upload_size | |
| id | 1634713 |
| size | 18,588 |
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.
+, -, +=, -=) on memory sizes.PartialOrd and Ord.10 kB, 1 GB).use memory_size::MemorySize;
fn main() {
let size1 = MemorySize::from_bytes(1024); // 1 KB
let size2 = MemorySize::from_bytes(2048); // 2 KB
let total = size1 + size2;
println!("Total size: {}", total); // Output: Total size: 3 kB
}
To run the testing scripts, use:
cargo test