From 4ea1dbc7d637a8b860fdeb0c441cee3883f28835 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 2 Aug 2022 10:43:06 +0200 Subject: [PATCH] Make `CardRarity` exaustive --- src/data/schema.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/data/schema.rs b/src/data/schema.rs index b858966..1f6321d 100644 --- a/src/data/schema.rs +++ b/src/data/schema.rs @@ -139,7 +139,7 @@ pub enum CardType { /// A spell. Spell, /// 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, /// An ability triggered by an unit. Ability, @@ -154,20 +154,28 @@ pub enum CardType { } -/// Possible card rarities. -#[non_exhaustive] +/// A possible card rarity. #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] pub enum CardRarity { + /// The card has no rarity, as it probably is not collectible. #[serde(alias = "NONE")] None, + /// A common card. #[serde(alias = "COMMON")] Common, + /// A rare card. #[serde(alias = "RARE")] Rare, + /// An epic card. #[serde(alias = "EPIC")] Epic, + /// A champion. #[serde(alias = "CHAMPION")] Champion, + + /// Unsupported card rarity. + #[serde(other)] + Unsupported, }