pub struct Card {
pub rank: Rank,
pub suit: Suit,
}Expand description
Single Card
Represents a single playing card with a rank and suit. Cards are ordered first by rank then by suit for consistent comparison.
§Examples
use open_pql::{Card, Rank::*, Suit::*};
let card = Card::new(RA, S);
assert_eq!(card.rank, RA);
assert_eq!(card.suit, S);
assert_eq!(card.to_string(), "As");Fields§
§rank: Rank§suit: SuitImplementations§
Source§impl Card
impl Card
Trait Implementations§
Source§impl Default for Card
Default implementation for Card.
impl Default for Card
Default implementation for Card.
Returns the Two of Spades as the default card.
Source§impl From<Card> for VmStackValue
impl From<Card> for VmStackValue
Source§impl FromStr for Card
FromStr implementation for Card.
impl FromStr for Card
FromStr implementation for Card.
Parses a card from string format like “As” (Ace of Spades). Whitespace is ignored during parsing.
§Errors
Returns ParseError::InvalidCard if the string cannot be parsed as a valid card.
§Examples
use open_pql::Card;
let card: Card = "As".parse().unwrap();
let card_with_spaces: Card = " A s ".parse().unwrap();Source§impl Ord for Card
impl Ord for Card
Source§impl PartialOrd for Card
impl PartialOrd for Card
impl Copy for Card
impl Eq for Card
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more