Skip to main content

Module format

Module format 

Source
Expand description

Small display formatters shared across the workspace.

Lives in microsandbox-utils so the CLI (crates/cli), the metrics collector (crates/metrics-collector), and anything else that needs human-readable byte counts or durations can use a single implementation. Output style is fixed (binary units for bytes, <mins>m<secs>s for durations) so output across surfaces stays consistent.

Functionsยง

format_bytes
Format a byte count with binary units (B, KiB, MiB, GiB, TiB). Values below 1 KiB are rendered as the exact byte count; everything larger uses one decimal.
format_duration
Format a duration for display. Sub-minute values are rendered as <seconds.1>s; longer ones as <mins>m<remaining-secs>s.