pub struct Hand(/* private fields */);Expand description
A hand of playing cards
Implementations§
Source§impl Hand
impl Hand
Sourcepub const fn from_bits_retain(bits: u64) -> Self
pub const fn from_bits_retain(bits: u64) -> Self
Create a hand from a bitset of cards, retaining invalid cards
Sourcepub const fn contains_unknown_bits(self) -> bool
pub const fn contains_unknown_bits(self) -> bool
Whether the hand contains an invalid card
Sourcepub const fn from_bits(bits: u64) -> Option<Self>
pub const fn from_bits(bits: u64) -> Option<Self>
Create a hand from a bitset of cards, checking for invalid cards
Sourcepub const fn from_bits_truncate(bits: u64) -> Self
pub const fn from_bits_truncate(bits: u64) -> Self
Create a hand from a bitset of cards, removing invalid cards
Sourcepub const fn new(
clubs: Holding,
diamonds: Holding,
hearts: Holding,
spades: Holding,
) -> Self
pub const fn new( clubs: Holding, diamonds: Holding, hearts: Holding, spades: Holding, ) -> Self
Create a hand from four holdings in suit order (clubs, diamonds, hearts, spades)
Sourcepub fn insert(&mut self, card: Card) -> bool
pub fn insert(&mut self, card: Card) -> bool
Insert a card into the hand, returning whether it was newly inserted
Sourcepub fn remove(&mut self, card: Card) -> bool
pub fn remove(&mut self, card: Card) -> bool
Remove a card from the hand, returning whether it was present
Sourcepub fn toggle(&mut self, card: Card) -> bool
pub fn toggle(&mut self, card: Card) -> bool
Toggle a card in the hand, returning whether it is now present
Trait Implementations§
Source§impl BitAndAssign for Hand
impl BitAndAssign for Hand
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl BitOrAssign for Hand
impl BitOrAssign for Hand
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl BitXorAssign for Hand
impl BitXorAssign for Hand
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^= operation. Read moreSource§impl Display for Hand
PBN-compatible display of a hand
impl Display for Hand
PBN-compatible display of a hand
This implementation ignores formatting flags for simplicity and speed.
Source§impl FromIterator<Card> for Hand
impl FromIterator<Card> for Hand
Source§impl IntoIterator for Hand
impl IntoIterator for Hand
Source§impl SubAssign for Hand
impl SubAssign for Hand
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Hand
impl Eq for Hand
impl StructuralPartialEq for Hand
Auto Trait Implementations§
impl Freeze for Hand
impl RefUnwindSafe for Hand
impl Send for Hand
impl Sync for Hand
impl Unpin for Hand
impl UnsafeUnpin for Hand
impl UnwindSafe for Hand
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