use std::fmt;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Number {
Singular,
Plural,
}
impl fmt::Display for Number {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Number::Singular => write!(f, "singular"),
Number::Plural => write!(f, "plural"),
}
}
}
pub(crate) fn stem_with_endings(stem: &str, endings: &[&str]) -> Vec<String> {
endings.iter().fold(Vec::new(), |mut acc, ending| {
acc.push(format!("{}{}", stem, ending));
acc
})
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_stem_with_endings() {
let stem = "part";
let endings = ["em", "im"];
assert_eq!(stem_with_endings(stem, &endings), ["partem".to_string(), "partim".to_string()]);
}
}