genius_invokation/cards/
mod.rs

1pub use character::*;
2mod character;
3
4pub use action::*;
5mod action;
6
7#[cfg(feature = "deck-url")]
8pub use deck_url::{deck_from_url, UrlDeckError};
9
10#[cfg(feature = "deck-url")]
11mod deck_url;
12
13/// Represents any card in Genius Invokation TCG
14#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
15pub enum Card {
16    Character(CharacterCard),
17    Action(ActionCard),
18}
19
20impl Card {
21    pub fn name(&self) -> &'static str {
22        match self {
23            Self::Character(card) => card.name(),
24            Self::Action(card)    => card.name(),
25        }
26    }
27}
28
29/// This is so that decks that include the same cards are also considered to be equal to each other
30/// 
31/// Array of cards is sorted before being built into a `Deck`.
32/// 
33/// However, I don't want to implement `Ord` as this is not supposed to be stable, and in an API
34/// perspective, it's not idiomatic for cards to implement it publicly
35pub(crate) trait CardOrd {
36    fn cmp(&self, other: &Self) -> std::cmp::Ordering;
37}