Migrate what bit of the yapper.py script there was to rust.
This commit is contained in:
46
src/og.rs
Normal file
46
src/og.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
use std::fmt;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub enum Gender {
|
||||
Male,
|
||||
Female,
|
||||
}
|
||||
|
||||
impl fmt::Display for Gender {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<String> for Gender {
|
||||
fn into(self) -> String {
|
||||
self.to_string().to_lowercase()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct Author {
|
||||
name: Name,
|
||||
gender: Gender,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub enum Name {
|
||||
FirstOnly {
|
||||
first: String,
|
||||
},
|
||||
Full {
|
||||
first: String,
|
||||
last: String,
|
||||
},
|
||||
UserOnly {
|
||||
user: String,
|
||||
},
|
||||
All {
|
||||
first: String,
|
||||
last: String,
|
||||
user: String,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user