pub trait BitSets {
fn add(&self, mask: u32) -> u32;
fn remove(&self, mask: u32) -> u32;
fn toggle(&self, mask: u32) -> u32;
fn contains(&self, mask: u32) -> bool;
fn contains_all(&self, mask: u32) -> bool;
fn set(&self, mask: u32, enabled: bool) -> u32;
}
Expand description
Utility mixins for bit sets. Designed to be imported with ‘using’ to supplement regular Ints with bitset functions.
Required Methods
Adds all the bits included in the mask, and returns the new bitset.
Removes all the bits included in the mask, and returns the new bitset.
Toggles all the bits included in the mask, and returns the new bitset.
Returns true if the bitset contains ANY of the bits in the given mask.
fn contains_all(&self, mask: u32) -> bool
fn contains_all(&self, mask: u32) -> bool
Returns true if the bitset contains ALL of the bits in the given mask.
Implementations on Foreign Types
sourceimpl BitSets for u32
impl BitSets for u32
sourcefn add(&self, mask: u32) -> u32
fn add(&self, mask: u32) -> u32
Adds all the bits included in the mask, and returns the new bitset.
sourcefn remove(&self, mask: u32) -> u32
fn remove(&self, mask: u32) -> u32
Removes all the bits included in the mask, and returns the new bitset.
sourcefn toggle(&self, mask: u32) -> u32
fn toggle(&self, mask: u32) -> u32
Toggles all the bits included in the mask, and returns the new bitset.
sourcefn contains(&self, mask: u32) -> bool
fn contains(&self, mask: u32) -> bool
Returns true if the bitset contains ANY of the bits in the given mask.
sourcefn contains_all(&self, mask: u32) -> bool
fn contains_all(&self, mask: u32) -> bool
Returns true if the bitset contains ALL of the bits in the given mask.