2018-09-02 19:12:52 +00:00
|
|
|
macro_rules! ffxiv_enum {
|
2018-10-08 15:28:51 +00:00
|
|
|
($(#[$meta:meta])* $name:ident { $($variant:ident => $str_repr:expr),+$(,)? }) => {
|
|
|
|
$(#[$meta])*
|
|
|
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
|
|
|
pub enum $name {
|
|
|
|
$($variant,)+
|
|
|
|
}
|
2018-09-02 19:12:52 +00:00
|
|
|
|
2018-10-08 15:28:51 +00:00
|
|
|
impl $name {
|
|
|
|
pub fn parse(s: &str) -> Option<Self> {
|
|
|
|
let res = match s.to_lowercase().as_str() {
|
|
|
|
$($str_repr => $name::$variant,)+
|
|
|
|
_ => return None,
|
|
|
|
};
|
|
|
|
Some(res)
|
|
|
|
}
|
2018-09-02 19:12:52 +00:00
|
|
|
|
2018-10-08 15:28:51 +00:00
|
|
|
pub fn name(&self) -> &str {
|
|
|
|
match *self {
|
|
|
|
$($name::$variant => $str_repr,)+
|
2018-09-02 19:12:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-08 15:28:51 +00:00
|
|
|
}
|
2018-09-02 19:12:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub mod character;
|
|
|
|
pub mod free_company;
|
2018-10-28 21:29:54 +00:00
|
|
|
pub mod linkshell;
|
2018-09-03 20:40:30 +00:00
|
|
|
pub mod search;
|
2018-09-03 19:32:17 +00:00
|
|
|
|
|
|
|
ffxiv_enum!(
|
|
|
|
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
GrandCompany {
|
2018-09-05 03:57:34 +00:00
|
|
|
Flames => "immortal flames",
|
|
|
|
Maelstrom => "maelstrom",
|
|
|
|
TwinAdders => "order of the twin adder",
|
2018-09-03 19:32:17 +00:00
|
|
|
}
|
|
|
|
);
|