Skip to main content

pluralize

Function pluralize 

Source
pub fn pluralize<'a>(n: u64, singular: &'a str, plural: &'a str) -> &'a str
Expand description

Pick singular when n == 1, plural otherwise. Trivial helper, but having one place beats if n == 1 { "x" } else { "xs" } sprinkled across six call sites — and grep-ing for pluralize is easier than chasing inline ternaries.