Skip to main content

Module size

Module size 

Source
Expand description

Byte-size types and conversion helpers.

Provides ByteSize, Bytes, and Mebibytes for type-safe size specification across the project. The SizeExt trait adds .bytes(), .kib(), .mib(), and .gib() helpers to integer literals.

use microsandbox_utils::size::{SizeExt, Mebibytes};

// All equivalent — 512 MiB:
let a: Mebibytes = 512.into();    // bare integer
let b: Mebibytes = 512.mib().into(); // explicit unit

// Cross-unit conversion:
let c: Mebibytes = 1.gib().into();  // 1 GiB → 1024 MiB

Structs§

ByteSize
A byte-size value returned by SizeExt helpers.
Bytes
A size measured in bytes.
Mebibytes
A size measured in mebibytes (MiB).

Traits§

SizeExt
Helper trait for readable byte sizes.