Skip to main content

format_speed_tabular

Function format_speed_tabular 

Source
pub fn format_speed_tabular(bps: f64, total_width: usize) -> String
Expand description

Format a speed value in Mbps with tabular alignment. Returns a fixed-width string like " 150.00 Mb/s" or " 0.12 Gb/s".

§Arguments

  • bps — Bits per second
  • total_width — Total column width including unit

§Examples

let s = format_speed_tabular(150_000_000.0, 14);
assert!(s.contains("Mb/s"));