29 lines
625 B
Rust
29 lines
625 B
Rust
macro_rules! ffxiv_enum {
|
|
($(#[$meta:meta])* $name:ident { $($variant:ident => $str_repr:expr),+$(,)? }) => {
|
|
$(#[$meta])*
|
|
#[derive(Debug, Serialize)]
|
|
pub enum $name {
|
|
$($variant,)+
|
|
}
|
|
|
|
impl $name {
|
|
pub fn parse(s: &str) -> Option<Self> {
|
|
let res = match s {
|
|
$($str_repr => $name::$variant,)+
|
|
_ => return None,
|
|
};
|
|
Some(res)
|
|
}
|
|
|
|
pub fn name(&self) -> &str {
|
|
match *self {
|
|
$($name::$variant => $str_repr,)+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
pub mod character;
|
|
pub mod free_company;
|