pub struct BitPlane(pub u64);Expand description
一个位平面的真值向量。
Tuple Fields§
§0: u64Implementations§
Source§impl BitPlane
impl BitPlane
Sourcepub const fn with_bit(bit: u32) -> Self
pub const fn with_bit(bit: u32) -> Self
构造指定位为 1 的平面。
环绕语义:位号按 bit % 64 取模,with_bit(64) 等价于 with_bit(0)。
需要拒绝越界位号时用 checked_with_bit。
Sourcepub const fn checked_with_bit(bit: u32) -> Option<Self>
pub const fn checked_with_bit(bit: u32) -> Option<Self>
构造指定位为 1 的平面;bit >= 64 返回 None。
Sourcepub const fn bit(self, bit: u32) -> bool
pub const fn bit(self, bit: u32) -> bool
该平面第 bit 位是否为 1。
环绕语义:位号按 bit % 64 取模,bit(64) 读的是第 0 位。
Sourcepub const fn checked_bit(self, bit: u32) -> Option<bool>
pub const fn checked_bit(self, bit: u32) -> Option<bool>
读取第 bit 位;bit >= 64 返回 None。
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
平面内 1 的个数(popcount)。
Trait Implementations§
impl Copy for BitPlane
impl Eq for BitPlane
impl StructuralPartialEq for BitPlane
Auto Trait Implementations§
impl Freeze for BitPlane
impl RefUnwindSafe for BitPlane
impl Send for BitPlane
impl Sync for BitPlane
impl Unpin for BitPlane
impl UnsafeUnpin for BitPlane
impl UnwindSafe for BitPlane
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