logo
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.

Returns true if the bitset contains ALL of the bits in the given mask.

Either adds or removes all the bits included in the mask, and returns the new bitset.

Implementations on Foreign Types

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.

Returns true if the bitset contains ALL of the bits in the given mask.

Either adds or removes all the bits included in the mask, and returns the new bitset.

Implementors