[−][src]Struct rustc_data_structures::bit_set::BitSet
A fixed-size bitset type with a dense representation. It does not support
resizing after creation; use GrowableBitSet
for that.
T
is an index type, typically a newtyped usize
wrapper, but it can also
just be usize
.
All operations that involve an element will panic if the element is equal to or greater than the domain size. All operations that involve two bitsets will panic if the bitsets have differing domain sizes.
Methods
impl<T: Idx> BitSet<T>
[src]
impl<T: Idx> BitSet<T>
pub fn new_empty(domain_size: usize) -> BitSet<T> | [src] |
Create a new, empty bitset with a given domain_size
.
pub fn new_filled(domain_size: usize) -> BitSet<T> | [src] |
Create a new, filled bitset with a given domain_size
.
pub fn domain_size(&self) -> usize | [src] |
Get the domain size.
pub fn clear(&mut self) | [src] |
Clear all elements.
pub fn overwrite(&mut self, other: &BitSet<T>) | [src] |
Efficiently overwrite self
with other
.
pub fn count(&self) -> usize | [src] |
Count the number of set bits in the set.
pub fn contains(&self, elem: T) -> bool | [src] |
True if self
contains elem
.
pub fn superset(&self, other: &BitSet<T>) -> bool | [src] |
Is self
is a (non-strict) superset of other
?
pub fn is_empty(&self) -> bool | [src] |
Is the set empty?
pub fn insert(&mut self, elem: T) -> bool | [src] |
Insert elem
. Returns true if the set has changed.
pub fn insert_all(&mut self) | [src] |
Sets all bits to true.
pub fn remove(&mut self, elem: T) -> bool | [src] |
Returns true if the set has changed.
pub fn union( | [src] |
Set self = self | other
and return true if self
changed
(i.e., if new bits were added).
pub fn subtract( | [src] |
Set self = self - other
and return true if self
changed.
(i.e., if any bits were removed).
pub fn intersect(&mut self, other: &BitSet<T>) -> bool | [src] |
Set self = self & other
and return true if self
changed.
(i.e., if any bits were removed).
pub fn words(&self) -> &[Word] | [src] |
Get a slice of the underlying words.
ⓘImportant traits for BitIter<'a, T>
pub fn iter<'a>(&'a self) -> BitIter<'a, T> | [src] |
Iterates over the indices of set bits in a sorted order.
pub fn to_hybrid(&self) -> HybridBitSet<T> | [src] |
Duplicates the set as a hybrid set.
Trait Implementations
impl<T: Idx> UnionIntoBitSet<T> for BitSet<T>
[src]
impl<T: Idx> UnionIntoBitSet<T> for BitSet<T>
fn union_into(&self, other: &mut BitSet<T>) -> bool | [src] |
impl<T: Idx> SubtractFromBitSet<T> for BitSet<T>
[src]
impl<T: Idx> SubtractFromBitSet<T> for BitSet<T>
fn subtract_from(&self, other: &mut BitSet<T>) -> bool | [src] |
impl<I: Idx, CTX> HashStable<CTX> for BitSet<I>
[src]
impl<I: Idx, CTX> HashStable<CTX> for BitSet<I>
fn hash_stable<W: StableHasherResult>( | [src] |
impl<T: Eq + Idx> Eq for BitSet<T>
[src]
impl<T: Eq + Idx> Eq for BitSet<T>
impl<T: PartialEq + Idx> PartialEq<BitSet<T>> for BitSet<T>
[src]
impl<T: PartialEq + Idx> PartialEq<BitSet<T>> for BitSet<T>
impl<T: Idx> ToString for BitSet<T>
[src]
impl<T: Idx> ToString for BitSet<T>
impl<T: Clone + Idx> Clone for BitSet<T>
[src]
impl<T: Clone + Idx> Clone for BitSet<T>
fn clone(&self) -> BitSet<T> | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl<T: Idx> Debug for BitSet<T>
[src]
impl<T: Idx> Debug for BitSet<T>
impl<T: Encodable + Idx> Encodable for BitSet<T>
[src]
impl<T: Encodable + Idx> Encodable for BitSet<T>
impl<T: Decodable + Idx> Decodable for BitSet<T>
[src]
impl<T: Decodable + Idx> Decodable for BitSet<T>
Auto Trait Implementations
Blanket Implementations
impl<T> Erased for T
[src]
impl<T> Erased for T
impl<T> Send for T where
T: ?Sized,
[src]
impl<T> Send for T where
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
impl<T> Sync for T where
T: ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'_ mut I
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
[src]
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
impl<T> Decodable for T where
T: UseSpecializedDecodable,
[src]
impl<T> Decodable for T where
T: UseSpecializedDecodable,
impl<E> SpecializationError for E
[src]
impl<E> SpecializationError for E
impl<T> Erased for T
impl<T> Erased for T