Skip to main content

pokebase_core/
set.rs

1use crate::locale;
2use crate::series;
3
4use serde::{Deserialize, Serialize};
5use std::fmt;
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct Set {
9    pub id: Id,
10    pub name: locale::Map,
11    pub series: series::Id,
12    pub release_date: String,
13    pub total_cards: usize,
14    pub abbreviation: Option<String>,
15}
16
17pub type Map = crate::Map<Id, Set>;
18
19#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
20pub struct Id(pub(crate) String);
21
22impl Id {
23    pub fn as_str(&self) -> &str {
24        &self.0
25    }
26}
27
28impl fmt::Display for Id {
29    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30        f.write_str(&self.0)
31    }
32}