mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 20:14:19 +00:00
a72f0ee43d
Co-authored-by: Stefano Pigozzi <me@steffo.eu>
12 lines
No EOL
277 B
Rust
12 lines
No EOL
277 B
Rust
use std::ops::Add;
|
|
|
|
pub fn countable_noun_suffix<T, U>(count: T, singular: &'static str, plural: &'static str)
|
|
-> &'static str
|
|
where
|
|
T: Default + Add<usize, Output=U> + PartialEq<U>,
|
|
{
|
|
match count == (T::default() + 1) {
|
|
true => singular,
|
|
false => plural,
|
|
}
|
|
} |