pub struct Card(pub Ordinal);
Expand description
wiki | Card class
A simple one-element tuple object wrapping an Ordinal
value,
which is just an alias for u8.
Tuple Fields§
§0: Ordinal
Implementations§
source§impl Card
impl Card
sourcepub const fn from_i32_const(v: i32) -> Option<Card>
pub const fn from_i32_const(v: i32) -> Option<Card>
Create a new Card
from an integer value.
sourcepub fn from_rank_suit(r: Rank, s: Suit) -> Card
pub fn from_rank_suit(r: Rank, s: Suit) -> Card
Create a new Card
from a Rank
and a Suit
. If the Rank
and
Suit
objects are valid, this cannot fail, so it returns a real Card
,
not an Option.
sourcepub fn low_ace_fix(v: Card) -> Card
pub fn low_ace_fix(v: Card) -> Card
Return a card value unmolested, unless it’s a high ace, in which case return the low ace of the same suit.
sourcepub fn high_ace_fix(v: Card) -> Card
pub fn high_ace_fix(v: Card) -> Card
Return a card value unmolested, unless it’s a low ace, in which case return the high ace of the same suit.
sourcepub fn suit(&self) -> aResult<Suit>
pub fn suit(&self) -> aResult<Suit>
Suit of the card if any. None
for jokers or illegal values.
sourcepub fn is_card(&self) -> bool
pub fn is_card(&self) -> bool
Does the object represent an actual card, and not a sentinel value?
sourcepub fn to_unicode(&self) -> String
pub fn to_unicode(&self) -> String
Produce text output form with Unicode suit symbol.
sourcepub fn to_unicode_single(&self) -> String
pub fn to_unicode_single(&self) -> String
Produce the single-character Unicode version of this card (U+1F0A1..U+1F0DF)
Trait Implementations§
source§impl Ord for Card
impl Ord for Card
source§impl PartialEq for Card
impl PartialEq for Card
source§impl PartialOrd for Card
impl PartialOrd for Card
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl 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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)