Crate bitmask_enum[−][src]
Expand description
Bitmask-Enum
A bitmask can have unsigned integer types, the default type is usize.
Don’t know how to document in proc-macro crates
so if you want see a better documentation
run cargo doc --open and select your Bitmask enum.
ⓘ
#[bitmask] // usize
enum Bitmask { /* ... */ }
#[bitmask(u8)] // u8
enum Bitmask { /* ... */ }Implemented Methods
ⓘ
// contains all values
const fn all() -> Self;
// if self contains all values
const fn is_all(&self) -> bool;
// contains no value
const fn none() -> Self;
// if self contains no value
const fn is_none(&self) -> bool;
// self intersects one of the other
// (self & other) != 0 || other == 0
const fn intersects(&self, other: Self) -> bool;
// self contains all of the other
// (self & other) == other
const fn contains(&self, other: Self) -> bool;
// constant bitwise ops
const fn not(self) -> Self;
const fn and(self, other: Self) -> Self;
const fn or(self, other: Self) -> Self;
const fn xor(self, other: Self) -> Self;Implemented Traits
ⓘ
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
impl std::ops::Not;
impl std::ops::BitAnd;
impl std::ops::BitAndAssign;
impl std::ops::BitOr;
impl std::ops::BitOrAssign;
impl std::ops::BitXor;
impl std::ops::BitXorAssign;
impl From<#type> for #ident;
impl From<#ident> for #type;
impl PartialEq<#type>;
impl std::fmt::Binary;