mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-25 04:24:20 +00:00
12 lines
277 B
Rust
12 lines
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,
|
||
|
}
|
||
|
}
|