pub struct Card {
pub suit: Suit,
pub rank: Rank,
}Expand description
A playing card
Fields§
§suit: SuitThe suit of the card
rank: RankThe rank of the card
Trait Implementations§
impl Copy for Card
Source§impl<'de> Deserialize<'de> for Card
impl<'de> Deserialize<'de> for Card
Source§fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Card
The rank then the suit, e.g. T♥. Rank leads because in gin rummy, as
in poker, the rank carries most of the information; parsing still accepts
either order (see the FromStr impl).
impl Display for Card
The rank then the suit, e.g. T♥. Rank leads because in gin rummy, as
in poker, the rank carries most of the information; parsing still accepts
either order (see the FromStr impl).
impl Eq for Card
Source§impl FromIterator<Card> for Hand
impl FromIterator<Card> for Hand
Source§impl FromStr for Card
impl FromStr for Card
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Accepts a rank and a suit glyph in either order. Display writes
the rank first (T♥); legacy suit-first text (♥T) still parses,
since rank and suit characters never overlap. Ranks are ASCII, one
byte each save 10, so the rank is the leading token, or the trailing
one if the leading split does not resolve.
Source§type Err = ParseCardError
type Err = ParseCardError
The associated error which can be returned from parsing.
impl StructuralPartialEq for Card
Auto Trait Implementations§
impl Freeze for Card
impl RefUnwindSafe for Card
impl Send for Card
impl Sync for Card
impl Unpin for Card
impl UnsafeUnpin for Card
impl UnwindSafe for Card
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more