Format a count with singular/plural label. # Arguments `count` - The count `singular` - The singular form of the noun `plural` - The plural form of the noun # Returns A formatted string like "1 file" or "3 files". # Example ```rust,ignore assert_eq!(format_count(1, "file", "files"), "1 file"); assert_eq!(format_count(3, "file", "files"), "3 files"); ```
(count: u64, singular: &str, plural: &str)
| 690 | /// assert_eq!(format_count(3, "file", "files"), "3 files"); |
| 691 | /// ``` |
| 692 | pub fn format_count(count: u64, singular: &str, plural: &str) -> String { |
| 693 | if count == 1 { |
| 694 | format!("1 {}", singular) |
| 695 | } else { |
| 696 | format!("{} {}", count, plural) |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | /// Format a count with auto-pluralization (appends 's'). |
| 701 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected