forked from akanyan/STARTLINER
29 lines
643 B
Rust
29 lines
643 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Serialize, Deserialize)]
|
|
pub enum Game {
|
|
#[serde(rename = "ongeki")]
|
|
Ongeki,
|
|
#[serde(rename = "chunithm")]
|
|
Chunithm,
|
|
}
|
|
|
|
impl Game {
|
|
pub fn from_str(s: &str) -> Option<Game> {
|
|
match s {
|
|
"ongeki" => Some(Game::Ongeki),
|
|
"chunithm" => Some(Game::Chunithm),
|
|
_ => None
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for Game {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
match self {
|
|
Game::Ongeki => write!(f, "ongeki"),
|
|
Game::Chunithm => write!(f, "chunithm")
|
|
}
|
|
}
|
|
}
|