Skip to main content

fmt_cost

Function fmt_cost 

Source
pub fn fmt_cost(usd: f64) -> String
Expand description

Format a cost as $12,345.67 — two decimals, thousands separator. Negative values render as -$5.00, not $-5.00. Amounts smaller than one cent but non-zero fall back to four decimals ($0.0040) so per-session costs don’t silently round to $0.00.