Struct rustc_ap_rustc_index::bit_set::BitSet[][src]

pub struct BitSet<T> { /* fields omitted */ }
Expand description

A fixed-size bitset type with a dense representation.

NOTE: Use GrowableBitSet if you need support for resizing after creation.

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.

Implementations

impl<T> BitSet<T>[src]

pub fn domain_size(&self) -> usize[src]

Gets the domain size.

impl<T: Idx> BitSet<T>[src]

pub fn new_empty(domain_size: usize) -> BitSet<T>[src]

Creates a new, empty bitset with a given domain_size.

pub fn new_filled(domain_size: usize) -> BitSet<T>[src]

Creates a new, filled bitset with a given domain_size.

pub fn clear(&mut self)[src]

Clear all elements.

pub fn count(&self) -> usize[src]

Count the number of set bits in the set.

pub fn contains(&self, elem: T) -> bool[src]

Returns 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 whether 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(&mut self, other: &impl UnionIntoBitSet<T>) -> bool[src]

Sets self = self | other and returns true if self changed (i.e., if new bits were added).

pub fn subtract(&mut self, other: &impl SubtractFromBitSet<T>) -> bool[src]

Sets self = self - other and returns true if self changed. (i.e., if any bits were removed).

pub fn intersect(&mut self, other: &BitSet<T>) -> bool[src]

Sets self = self & other and return true if self changed. (i.e., if any bits were removed).

pub fn words(&self) -> &[Word][src]

Gets a slice of the underlying words.

pub fn iter(&self) -> BitIter<'_, T>

Notable traits for BitIter<'a, T>

impl<'a, T: Idx> Iterator for BitIter<'a, T> type Item = 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> Clone for BitSet<T>[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, from: &Self)[src]

Performs copy-assignment from source. Read more

impl<T: Idx> Debug for BitSet<T>[src]

fn fmt(&self, w: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T, __D: Decoder> Decodable<__D> for BitSet<T> where
    T: Decodable<__D>, 
[src]

fn decode(__decoder: &mut __D) -> Result<Self, <__D as Decoder>::Error>[src]

impl<T, __E: Encoder> Encodable<__E> for BitSet<T> where
    T: Encodable<__E>, 
[src]

fn encode(&self, __encoder: &mut __E) -> Result<(), <__E as Encoder>::Error>[src]

impl<T: PartialEq> PartialEq<BitSet<T>> for BitSet<T>[src]

fn eq(&self, other: &BitSet<T>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &BitSet<T>) -> bool[src]

This method tests for !=.

impl<T: Idx> SubtractFromBitSet<T> for BitSet<T>[src]

fn subtract_from(&self, other: &mut BitSet<T>) -> bool[src]

impl<T: Idx> ToString for BitSet<T>[src]

fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T: Idx> UnionIntoBitSet<T> for BitSet<T>[src]

fn union_into(&self, other: &mut BitSet<T>) -> bool[src]

impl<T: Eq> Eq for BitSet<T>[src]

impl<T> StructuralEq for BitSet<T>[src]

impl<T> StructuralPartialEq for BitSet<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BitSet<T> where
    T: RefUnwindSafe

impl<T> Send for BitSet<T> where
    T: Send

impl<T> Sync for BitSet<T> where
    T: Sync

impl<T> Unpin for BitSet<T> where
    T: Unpin

impl<T> UnwindSafe for BitSet<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.