valorant_api_official 0.1.4

A library for interacting with the Official Valorant API.
Documentation
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,
    ConsoleCompetitive,
    ConsoleDeathmatch,
    ConsoleGgteam,
    ConsoleNewmap,
    ConsoleOnefa,
    ConsoleSeeding,
    ConsoleSpikerush,
    ConsoleSwiftplay,
    ConsoleTournamentmode,
    ConsoleUnrated,
    ConsoleSnowball,
    ConsolePremier,
    ConsoleHurm,
}

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),
            "console_competitive" => Ok(Queue::ConsoleCompetitive),
            "console_deathmatch" => Ok(Queue::ConsoleDeathmatch),
            "console_ggteam" => Ok(Queue::ConsoleGgteam),
            "console_newmap" => Ok(Queue::ConsoleNewmap),
            "console_onefa" => Ok(Queue::ConsoleOnefa),
            "console_seeding" => Ok(Queue::ConsoleSeeding),
            "console_spikerush" => Ok(Queue::ConsoleSpikerush),
            "console_swiftplay" => Ok(Queue::ConsoleSwiftplay),
            "console_tournamentmode" => Ok(Queue::ConsoleTournamentmode),
            "console_unrated" => Ok(Queue::ConsoleUnrated),
            "console_snowball" => Ok(Queue::ConsoleSnowball),
            "console_premier" => Ok(Queue::ConsolePremier),
            "console_hurm" => Ok(Queue::ConsoleHurm),
            _ => 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"),
            Queue::ConsoleCompetitive => write!(f, "console_competitive"),
            Queue::ConsoleDeathmatch => write!(f, "console_deathmatch"),
            Queue::ConsoleGgteam => write!(f, "console_ggteam"),
            Queue::ConsoleNewmap => write!(f, "console_newmap"),
            Queue::ConsoleOnefa => write!(f, "console_onefa"),
            Queue::ConsoleSeeding => write!(f, "console_seeding"),
            Queue::ConsoleSpikerush => write!(f, "console_spikerush"),
            Queue::ConsoleSwiftplay => write!(f, "console_swiftplay"),
            Queue::ConsoleTournamentmode => write!(f, "console_tournamentmode"),
            Queue::ConsoleUnrated => write!(f, "console_unrated"),
            Queue::ConsoleSnowball => write!(f, "console_snowball"),
            Queue::ConsolePremier => write!(f, "console_premier"),
            Queue::ConsoleHurm => write!(f, "console_hurm"),
        }
    }
}