Merge branch 'main' into configuration

This commit is contained in:
Emi Simpson 2021-10-29 12:16:19 -04:00
commit 5087d4738d
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 26 additions and 1 deletions

View File

@ -127,7 +127,7 @@ impl Default for InstanceSettings {
/// she/her or she/her/hers.
///
/// Methods are provided to quickly generate these shorter forms, as well as example sentences.
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(from = "[String; 5]", into = "[String; 5]")]
pub struct Pronoun {
@ -174,6 +174,31 @@ impl Pronoun {
}
}
impl fmt::Debug for Pronoun {
/// Pronouns are formatted with a vertical bar seperating forms
///
/// ## Example
///
/// ```
/// # use pronouns_today::Pronoun;
/// let pronoun: Pronoun = ["she", "her", "her", "hers", "herself"].into();
/// assert_eq!(
/// format!("{:?}", pronoun),
/// "Pronoun(she | her | her | hers | herself)"
/// )
/// ```
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f,
"Pronoun({} | {} | {} | {} | {})",
self.subject_pronoun,
self.object_pronoun,
self.possesive_determiner,
self.possesive_pronoun,
self.reflexive_pronoun,
)
}
}
impl fmt::Display for Pronoun {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.render_threeform())