refactor: don't use snake case
This commit is contained in:
parent
e6e1f8ff51
commit
d6f914b9c7
|
@ -1,28 +1,27 @@
|
|||
macro_rules! ffxiv_enum {
|
||||
($(#[$meta:meta])* $name:ident { $($variant:ident => $str_repr:expr),+$(,)? }) => {
|
||||
$(#[$meta])*
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum $name {
|
||||
$($variant,)+
|
||||
($(#[$meta:meta])* $name:ident { $($variant:ident => $str_repr:expr),+$(,)? }) => {
|
||||
$(#[$meta])*
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
pub enum $name {
|
||||
$($variant,)+
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &str {
|
||||
match *self {
|
||||
$($name::$variant => $str_repr,)+
|
||||
}
|
||||
pub fn name(&self) -> &str {
|
||||
match *self {
|
||||
$($name::$variant => $str_repr,)+
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod character;
|
||||
|
|
Loading…
Reference in New Issue