riot_api/models/
active_shard.rs

1use std::fmt::{Display, Formatter};
2use serde::Deserialize;
3
4#[derive(Deserialize, Clone, Debug)]
5#[serde(rename_all = "camelCase")]
6pub struct ActiveShardDto {
7    pub puuid: String,
8    pub game: String,
9    pub active_shard: String,
10}
11
12impl Eq for ActiveShardDto {}
13impl PartialEq for ActiveShardDto {
14    fn eq(&self, other: &Self) -> bool {
15        self.puuid == other.puuid
16    }
17}
18
19impl Into<String> for ActiveShardDto {
20    fn into(self) -> String {
21        self.puuid
22    }
23}
24
25impl Display for ActiveShardDto {
26    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
27        write!(
28            f, "{} ({}) - {}",
29            &self.puuid, &self.game, &self.active_shard
30        )
31    }
32}
33
34pub enum ActiveShardGame {
35    LoR,
36    Valorant,
37}
38impl Into<String> for ActiveShardGame {
39    fn into(self) -> String {
40        match self {
41            Self::LoR => "lor",
42            Self::Valorant => "val",
43        }.to_string()
44    }
45}