1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 20:14:19 +00:00
royalnet/src/utils/italian.rs
Lorenzo Rossi a72f0ee43d
Differentiate between unknown command and parse error (#14)
Co-authored-by: Stefano Pigozzi <me@steffo.eu>
2024-08-25 12:49:29 +02:00

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,
}
}