(usd: f64)
| 784 | } |
| 785 | |
| 786 | fn format_cost(usd: f64) -> String { |
| 787 | if usd == 0.0 { |
| 788 | "$0.00".to_string() |
| 789 | } else if usd < 0.01 { |
| 790 | format!("${:.4}", usd) |
| 791 | } else { |
| 792 | format!("${:.2}", usd) |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | fn format_count(n: usize, word: &str) -> String { |
| 797 | if n == 1 { |