1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-23 01:54:22 +00:00

Make CardRarity exaustive

This commit is contained in:
Steffo 2022-08-02 10:43:06 +02:00
parent 0c86a7f07c
commit 4ea1dbc7d6
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -139,7 +139,7 @@ pub enum CardType {
/// A spell. /// A spell.
Spell, Spell,
/// An unit: either a minion, or a champion. /// An unit: either a minion, or a champion.
/// Champions have their `supertype` set to `Champion`. /// Champions have their `supertype` set to `Champion`, and their `rarity` set to `Champion` as well.
Unit, Unit,
/// An ability triggered by an unit. /// An ability triggered by an unit.
Ability, Ability,
@ -154,20 +154,28 @@ pub enum CardType {
} }
/// Possible card rarities. /// A possible card rarity.
#[non_exhaustive]
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub enum CardRarity { pub enum CardRarity {
/// The card has no rarity, as it probably is not collectible.
#[serde(alias = "NONE")] #[serde(alias = "NONE")]
None, None,
/// A common card.
#[serde(alias = "COMMON")] #[serde(alias = "COMMON")]
Common, Common,
/// A rare card.
#[serde(alias = "RARE")] #[serde(alias = "RARE")]
Rare, Rare,
/// An epic card.
#[serde(alias = "EPIC")] #[serde(alias = "EPIC")]
Epic, Epic,
/// A champion.
#[serde(alias = "CHAMPION")] #[serde(alias = "CHAMPION")]
Champion, Champion,
/// Unsupported card rarity.
#[serde(other)]
Unsupported,
} }