Expand Pronoun struct
This commit is contained in:
parent
4ce602c14a
commit
b04d8ed8bc
51
src/lib.rs
51
src/lib.rs
|
@ -40,10 +40,26 @@ impl InstanceSettings {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_prefstring(&self, pref_string: Option<impl AsRef<str>>) -> &str {
|
}
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
impl Default for InstanceSettings {
|
||||||
|
fn default() -> Self {
|
||||||
|
let pronouns: Vec<Pronoun> = vec![
|
||||||
|
["she", "her", "her", "hers", "herself" ].into(),
|
||||||
|
["he", "him", "his", "his", "himself" ].into(),
|
||||||
|
["they", "them", "their", "theirs", "themself" ].into(),
|
||||||
|
["it", "it", "its", "its", "itself" ].into(),
|
||||||
|
["xe", "xem", "xyr", "xyrs", "xemself" ].into(),
|
||||||
|
["ze", "zem", "zyr", "zyrs", "zemself" ].into(),
|
||||||
|
["fae", "faer", "faer", "faers", "faerself" ].into(),
|
||||||
|
["ne", "nem", "nir", "nirs", "nirself" ].into(),
|
||||||
|
["e", "em", "eir", "eirs", "eirself" ].into(),
|
||||||
|
["vey", "vem", "ver", "vers", "verself" ].into(),
|
||||||
|
];
|
||||||
|
InstanceSettings {
|
||||||
|
pronoun_list: pronouns
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A standard five-form pronoun set
|
/// A standard five-form pronoun set
|
||||||
|
@ -95,6 +111,18 @@ pub struct Pronoun {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Pronoun {
|
||||||
|
pub fn render_threeform(&self) -> String {
|
||||||
|
format!("{}/{}/{}", self.subject_pronoun, self.object_pronoun, self.possesive_pronoun)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Pronoun {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.write_str(&self.render_threeform())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<[String; 5]> for Pronoun {
|
impl From<[String; 5]> for Pronoun {
|
||||||
fn from(five_form: [String; 5]) -> Self {
|
fn from(five_form: [String; 5]) -> Self {
|
||||||
let mut five_form = IntoIterator::into_iter(five_form);
|
let mut five_form = IntoIterator::into_iter(five_form);
|
||||||
|
@ -109,15 +137,20 @@ impl From<[String; 5]> for Pronoun {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<[&str; 5]> for Pronoun {
|
||||||
|
fn from(five_form: [&str; 5]) -> Self {
|
||||||
|
(&five_form).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<&[&str; 5]> for Pronoun {
|
impl From<&[&str; 5]> for Pronoun {
|
||||||
fn from(five_form: &[&str; 5]) -> Self {
|
fn from(five_form: &[&str; 5]) -> Self {
|
||||||
let mut five_form = IntoIterator::into_iter(five_form);
|
|
||||||
Pronoun {
|
Pronoun {
|
||||||
subject_pronoun: five_form.next().unwrap().to_string(),
|
subject_pronoun: five_form[0].to_string(),
|
||||||
object_pronoun: five_form.next().unwrap().to_string(),
|
object_pronoun: five_form[1].to_string(),
|
||||||
possesive_determiner: five_form.next().unwrap().to_string(),
|
possesive_determiner: five_form[2].to_string(),
|
||||||
possesive_pronoun: five_form.next().unwrap().to_string(),
|
possesive_pronoun: five_form[3].to_string(),
|
||||||
reflexive_pronoun: five_form.next().unwrap().to_string(),
|
reflexive_pronoun: five_form[4].to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue