pub struct Suit4(/* private fields */);Expand description
Suit Masks
A compact bit-set representation for storing multiple suits using a single u8. Each bit represents whether a specific suit is present in the set. Supports efficient set operations like union, intersection, and membership testing.
§Memory Layout:
[8, 0]: xxxxCDHS // x: unused§Examples
use open_pql::{Suit::*, Suit4};
let mut suits = Suit4::default();
suits.set(S);
suits.set(H);
assert!(suits.contains_suit(S));
assert_eq!(suits.count(), 2);Implementations§
Source§impl Suit4
impl Suit4
Sourcepub const fn is_empty(self) -> bool
pub const fn is_empty(self) -> bool
Checks whether all suit masks are unset
§Examples
use open_pql::{Suit, Suit4};
let empty: Suit4 = Suit4::default();
let not_empty: Suit4 = Suit4::from(Suit::D);
assert!(empty.is_empty());
assert!(!not_empty.is_empty());Sourcepub const fn contains_suit(self, s: Suit) -> bool
pub const fn contains_suit(self, s: Suit) -> bool
Sourcepub const fn count(&self) -> PQLCardCount
pub const fn count(&self) -> PQLCardCount
Returns the number of marked suits
§Examples
use open_pql::{Suit, Suit4};
let mut suits: Suit4 = Suit4::from(Suit::D);
assert_eq!(suits.count(), 1);Trait Implementations§
impl Copy for Suit4
impl Eq for Suit4
impl StructuralPartialEq for Suit4
Auto Trait Implementations§
impl Freeze for Suit4
impl RefUnwindSafe for Suit4
impl Send for Suit4
impl Sync for Suit4
impl Unpin for Suit4
impl UnwindSafe for Suit4
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