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