pub struct Holding(/* private fields */);Expand description
A set of cards of the same suit
Implementations§
Source§impl Holding
impl Holding
Sourcepub const fn insert(&mut self, rank: Rank) -> bool
pub const fn insert(&mut self, rank: Rank) -> bool
Insert a rank into the holding, returning whether it was newly inserted
Sourcepub const fn remove(&mut self, rank: Rank) -> bool
pub const fn remove(&mut self, rank: Rank) -> bool
Remove a rank from the holding, returning whether it was present
Sourcepub const fn toggle(&mut self, rank: Rank) -> bool
pub const fn toggle(&mut self, rank: Rank) -> bool
Toggle a rank in the holding, returning whether it is now present
Sourcepub const fn set(&mut self, rank: Rank, condition: bool)
pub const fn set(&mut self, rank: Rank, condition: bool)
Conditionally insert/remove a rank from the holding
Sourcepub const fn iter(self) -> HoldingIter ⓘ
pub const fn iter(self) -> HoldingIter ⓘ
Iterate over the ranks in the holding
Sourcepub const fn from_bits_retain(bits: u16) -> Self
pub const fn from_bits_retain(bits: u16) -> Self
Create a holding from a bitset of ranks, retaining invalid ranks
Sourcepub const fn contains_unknown_bits(self) -> bool
pub const fn contains_unknown_bits(self) -> bool
Whether the holding contains an invalid rank
Sourcepub const fn from_bits(bits: u16) -> Option<Self>
pub const fn from_bits(bits: u16) -> Option<Self>
Create a holding from a bitset of ranks, checking for invalid ranks
Sourcepub const fn from_bits_truncate(bits: u16) -> Self
pub const fn from_bits_truncate(bits: u16) -> Self
Create a holding from a bitset of ranks, removing invalid ranks
Trait Implementations§
Source§impl BitAndAssign for Holding
impl BitAndAssign for Holding
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl BitOrAssign for Holding
impl BitOrAssign for Holding
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl BitXorAssign for Holding
impl BitXorAssign for Holding
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^= operation. Read moreSource§impl Display for Holding
Show cards in descending order
impl Display for Holding
Show cards in descending order
- The ten is shown as
Tfor PBN compatibility. - This implementation ignores formatting flags for simplicity and speed.
If you want to pad or align the output, use
fmt::Formatter::pad.
Source§impl IntoIterator for Holding
impl IntoIterator for Holding
Source§impl SubAssign for Holding
impl SubAssign for Holding
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Holding
impl Eq for Holding
impl StructuralPartialEq for Holding
Auto Trait Implementations§
impl Freeze for Holding
impl RefUnwindSafe for Holding
impl Send for Holding
impl Sync for Holding
impl Unpin for Holding
impl UnsafeUnpin for Holding
impl UnwindSafe for Holding
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