pub struct Bmp<const N: XwSz>where
[XwBmp; { _ }]: Sized,{ /* private fields */ }
Expand description
位图类型
常数 N
表示有多少位。
Implementations§
source§impl<const N: XwSz> Bmp<N>where
[XwBmp; { _ }]: Sized,
impl<const N: XwSz> Bmp<N>where
[XwBmp; { _ }]: Sized,
sourcepub const fn new() -> Self
pub const fn new() -> Self
新建位图
此方法是编译期方法。
§示例
- 具有
'static
约束的全局变量全局变量:
use xwrust::xwbmp::*;
static GLOBAL_BMP = Bmp::<8>::new();
- 在函数中创建:
extern crate alloc;
use alloc::sync::Arc;
use xwrust::xwbmp::*;
pub fn some_function() {
let msk = Bmp::<8>::new();
}
- 在heap上创建:
extern crate alloc;
use alloc::sync::Arc;
use xwrust::xwbmp::*;
pub fn some_function() {
let msk = Arc::new(Bmp::<8>::new());
}
sourcepub fn t1ma_then_c0m(&self, msk: &Self) -> bool
pub fn t1ma_then_c0m(&self, msk: &Self) -> bool
测试位图中掩码部分是否全部为 1 ,如果是,就将掩码部分全部清 0
sourcepub fn t1mo_then_c0m(&self, msk: &Self) -> bool
pub fn t1mo_then_c0m(&self, msk: &Self) -> bool
测试位图中掩码部分是否至少有一位为 1 ,如果是,就将掩码部分全部清 0
sourcepub fn t0ma_then_s1m(&self, msk: &Self) -> bool
pub fn t0ma_then_s1m(&self, msk: &Self) -> bool
测试位图中掩码部分是否全部为 0 ,如果是,就将掩码部分全部置 1
sourcepub fn t0mo_then_s1m(&self, msk: &Self) -> bool
pub fn t0mo_then_s1m(&self, msk: &Self) -> bool
测试位图中掩码部分是否至少有一位为 0 ,如果是,就将掩码部分全部置 1
Trait Implementations§
source§impl<const N: XwSz> BitAndAssign for Bmp<N>where
[XwBmp; { _ }]: Sized,
impl<const N: XwSz> BitAndAssign for Bmp<N>where
[XwBmp; { _ }]: Sized,
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Performs the
&=
operation. Read moresource§impl<const N: XwSz> BitOrAssign for Bmp<N>where
[XwBmp; { _ }]: Sized,
impl<const N: XwSz> BitOrAssign for Bmp<N>where
[XwBmp; { _ }]: Sized,
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Performs the
|=
operation. Read moresource§impl<const N: XwSz> BitXorAssign for Bmp<N>where
[XwBmp; { _ }]: Sized,
impl<const N: XwSz> BitXorAssign for Bmp<N>where
[XwBmp; { _ }]: Sized,
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
Performs the
^=
operation. Read more