refactor: split cargo workspace
This commit is contained in:
parent
5db14936e7
commit
1c21bd1259
695 changed files with 32023 additions and 44964 deletions
32
crates/utils/src/bitflags.rs
Normal file
32
crates/utils/src/bitflags.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
pub trait BitflagsExt {
|
||||
fn contains(self, other: Self) -> bool;
|
||||
fn not_contains(self, other: Self) -> bool;
|
||||
fn intersects(self, other: Self) -> bool;
|
||||
}
|
||||
|
||||
macro_rules! num {
|
||||
($ty:ident) => {
|
||||
impl BitflagsExt for $ty {
|
||||
fn contains(self, other: Self) -> bool {
|
||||
self & other == other
|
||||
}
|
||||
|
||||
fn not_contains(self, other: Self) -> bool {
|
||||
self & other != other
|
||||
}
|
||||
|
||||
fn intersects(self, other: Self) -> bool {
|
||||
self & other != 0
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
num!(u8);
|
||||
num!(u16);
|
||||
num!(u32);
|
||||
num!(u64);
|
||||
num!(i8);
|
||||
num!(i16);
|
||||
num!(i32);
|
||||
num!(i64);
|
||||
Loading…
Add table
Add a link
Reference in a new issue