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 below1 KiBare 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.