pub struct Rank16(/* private fields */);Expand description
Rank Set
A compact bit-set representation for storing multiple ranks using a single u16. Each bit represents whether a specific rank is present in the set. Supports efficient set operations like union, intersection, and membership testing.
§Memory Layout:
[15, 0]: xxxAKQJT 98765432 // x: unused§Examples
use open_pql::{Rank::*, Rank16};
let mut ranks = Rank16::default();
ranks.set(RA);
ranks.set(RK);
assert!(ranks.contains_rank(RA));
assert_eq!(ranks.count(), 2);Implementations§
Source§impl Rank16
impl Rank16
Sourcepub const fn is_empty(self) -> bool
pub const fn is_empty(self) -> bool
Checks whether all rank masks are unset
§Examples
use open_pql::{Rank, Rank16};
let ranks: Rank16 = Rank16::from(Rank::RA);
assert!(!ranks.is_empty());Sourcepub const fn contains_rank(self, r: Rank) -> bool
pub const fn contains_rank(self, r: Rank) -> bool
Sourcepub const fn count(self) -> PQLCardCount
pub const fn count(self) -> PQLCardCount
Returns the number of marked ranks
§Examples
use open_pql::{Rank, Rank16};
let ranks: Rank16 = Rank16::from(Rank::RA);
assert_eq!(ranks.count(), 1);Trait Implementations§
Source§impl BitAndAssign for Rank16
impl BitAndAssign for Rank16
Source§fn bitand_assign(&mut self, rhs: Rank16)
fn bitand_assign(&mut self, rhs: Rank16)
Performs the
&= operation. Read moreSource§impl BitOrAssign for Rank16
impl BitOrAssign for Rank16
Source§fn bitor_assign(&mut self, rhs: Rank16)
fn bitor_assign(&mut self, rhs: Rank16)
Performs the
|= operation. Read moreSource§impl From<Rank16> for VmStackValue
impl From<Rank16> for VmStackValue
Source§fn from(value: PQLRankSet) -> Self
fn from(value: PQLRankSet) -> Self
Converts to this type from the input type.
Source§impl Ord for Rank16
impl Ord for Rank16
Source§impl PartialOrd for Rank16
impl PartialOrd for Rank16
impl Copy for Rank16
impl Eq for Rank16
impl StructuralPartialEq for Rank16
Auto Trait Implementations§
impl Freeze for Rank16
impl RefUnwindSafe for Rank16
impl Send for Rank16
impl Sync for Rank16
impl Unpin for Rank16
impl UnwindSafe for Rank16
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