use serde::{Deserialize, Serialize};
use std::fmt::Display;
use std::str::FromStr;
#[derive(PartialEq, Eq, Hash, Serialize, Deserialize, Debug, Clone, Copy)]
#[serde(rename_all = "lowercase")]
pub enum Queue {
COMPETITIVE,
DEATHMATCH,
GGTEAM,
NEWMAP,
ONEFA,
SEEDING,
SPIKERUSH,
SWIFTPLAY,
TOURNAMENTMODE,
UNRATED,
SNOWBALL,
PREMIER,
HURM,
}
impl FromStr for Queue {
type Err = ();
fn from_str(input: &str) -> Result<Queue, Self::Err> {
match input {
"competitive" => Ok(Queue::COMPETITIVE),
"deathmatch" => Ok(Queue::DEATHMATCH),
"ggteam" => Ok(Queue::GGTEAM),
"newmap" => Ok(Queue::NEWMAP),
"onefa" => Ok(Queue::ONEFA),
"seeding" => Ok(Queue::SEEDING),
"spikerush" => Ok(Queue::SPIKERUSH),
"swiftplay" => Ok(Queue::SWIFTPLAY),
"tournamentmode" => Ok(Queue::TOURNAMENTMODE),
"unrated" => Ok(Queue::UNRATED),
"snowball" => Ok(Queue::SNOWBALL),
"premier" => Ok(Queue::PREMIER),
"hurm" => Ok(Queue::HURM),
_ => Err(()),
}
}
}
impl Display for Queue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Queue::COMPETITIVE => write!(f, "competitive"),
Queue::DEATHMATCH => write!(f, "deathmatch"),
Queue::GGTEAM => write!(f, "ggteam"),
Queue::NEWMAP => write!(f, "newmap"),
Queue::ONEFA => write!(f, "onefa"),
Queue::SEEDING => write!(f, "seeding"),
Queue::SPIKERUSH => write!(f, "spikerush"),
Queue::SWIFTPLAY => write!(f, "swiftplay"),
Queue::TOURNAMENTMODE => write!(f, "tournamentmode"),
Queue::UNRATED => write!(f, "unrated"),
Queue::SNOWBALL => write!(f, "snowball"),
Queue::PREMIER => write!(f, "premier"),
Queue::HURM => write!(f, "hurm"),
}
}
}