Crate bitmask_enum[][src]

Bitmask-Enum

A bitmask can have unsigned integer types, the default type is usize.

To see a better documentation run cargo doc --open and select your Bitmask.

#[bitmask] // usize
enum Bitmask { /* ... */ }

#[bitmask(u8)] // u8
enum Bitmask { /* ... */ }

Implemented Methods

// contains all values
const fn all() -> Self;

// self contains all values
const fn is_all(&self) -> bool;

// contains no value
const fn none() -> Self;

// self contains no value
const fn is_none(&self) -> bool;

// self contains one of the other
// (self & other) != 0 || other == 0
const fn contains(&self, other: Self) -> bool;

// self contains all of the other
// (self & other) == other
const fn contains_all(&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>;
impl Into<#type>;

impl PartialEq<#type>;

impl std::fmt::Binary;

Attribute Macros

bitmask