(usd: f64)
| 636 | } |
| 637 | |
| 638 | fn format_cost(usd: f64) -> String { |
| 639 | if usd == 0.0 { |
| 640 | "$0.00".to_string() |
| 641 | } else if usd < 0.01 { |
| 642 | format!("${:.4}", usd) |
| 643 | } else { |
| 644 | format!("${:.2}", usd) |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | fn format_count(n: usize, word: &str) -> String { |
| 649 | if n == 1 { |