Skip to main content

Module format

Module format 

Source
Expand description

Compact human-readable formatting for narrow terminal cells.

Functions§

age
Formats how long ago something happened, e.g. "45s ago", "8m ago", "3d ago".
bytes
Formats a byte count with a binary unit, e.g. "1.5G", "512K", "0B".
duration
Formats a duration in seconds as "3d04h", "5h12m" or "12:34".
link_speed
Formats a link speed in Mbit/s, e.g. "10G", "2.5G", "100M".
pad
Truncates text to width terminal columns and pads it with spaces to exactly that width (format!("{:<N}") counts characters, not columns).
rate
Formats a throughput, e.g. "3.4M/s".
truncate
Truncates text to at most width characters, marking the cut with ….