Struct libcoinche::cards::Card [] [src]

pub struct Card(_);

Represents a single card.

Methods

impl Card

fn id(self) -> u32

Returns the card id (from 0 to 31).

fn from_id(id: u32) -> Self

Returns the card corresponding to the given id.

Panics

If id >= 32

fn rank(self) -> Rank

Returns the card's rank.

fn suit(self) -> Suit

Returns the card's suit.

fn to_string(self) -> String

Returns a string representation of the card (ex: "7♦").

fn new(suit: Suit, rank: Rank) -> Self

Creates a card from the given suit and rank.

Trait Implementations

impl Encodable for Card

fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>

impl Decodable for Card

fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>

Derived Implementations

impl Debug for Card

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Copy for Card

impl Clone for Card

fn clone(&self) -> Card

fn clone_from(&mut self, source: &Self)

impl PartialEq for Card

fn eq(&self, __arg_0: &Card) -> bool

fn ne(&self, __arg_0: &Card) -> bool