use serde::{Deserialize, Serialize};
use std::str::FromStr;
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "lowercase")]
#[derive(PartialEq, Eq, Hash)]
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 ToString for Queue {
fn to_string(&self) -> String {
(match self {
Queue::COMPETITIVE => "competitive",
Queue::DEATHMATCH => "deathmatch",
Queue::GGTEAM => "ggteam",
Queue::NEWMAP => "newmap",
Queue::ONEFA => "onefa",
Queue::SEEDING => "seeding",
Queue::SPIKERUSH => "spikerush",
Queue::SWIFTPLAY => "swiftplay",
Queue::TOURNAMENTMODE => "tournamentmode",
Queue::UNRATED => "unrated",
Queue::SNOWBALL => "snowball",
Queue::PREMIER => "premier",
Queue::HURM => "hurm",
})
.to_string()
}
}