Struct rustc_ap_rustc_index::bit_set::BitMatrix[][src]

pub struct BitMatrix<R: Idx, C: Idx> { /* fields omitted */ }
Expand description

A fixed-size 2D bit matrix type with a dense representation.

R and C are index types used to identify rows and columns respectively; typically newtyped usize wrappers, but they can also just be usize.

All operations that involve a row and/or column index will panic if the index exceeds the relevant bound.

Implementations

impl<R: Idx, C: Idx> BitMatrix<R, C>[src]

pub fn new(num_rows: usize, num_columns: usize) -> BitMatrix<R, C>[src]

Creates a new rows x columns matrix, initially empty.

pub fn from_row_n(row: &BitSet<C>, num_rows: usize) -> BitMatrix<R, C>[src]

Creates a new matrix, with row used as the value for every row.

pub fn rows(&self) -> impl Iterator<Item = R>[src]

pub fn insert(&mut self, row: R, column: C) -> bool[src]

Sets the cell at (row, column) to true. Put another way, insert column to the bitset for row.

Returns true if this changed the matrix.

pub fn contains(&self, row: R, column: C) -> bool[src]

Do the bits from row contain column? Put another way, is the matrix cell at (row, column) true? Put yet another way, if the matrix represents (transitive) reachability, can row reach column?

pub fn intersect_rows(&self, row1: R, row2: R) -> Vec<C>[src]

Returns those indices that are true in rows a and b. This is an O(n) operation where n is the number of elements (somewhat independent from the actual size of the intersection, in particular).

pub fn union_rows(&mut self, read: R, write: R) -> bool[src]

Adds the bits from row read to the bits from row write, and returns true if anything changed.

This is used when computing transitive reachability because if you have an edge write -> read, because in that case write can reach everything that read can (and potentially more).

pub fn union_row_with(&mut self, with: &BitSet<C>, write: R) -> bool[src]

Adds the bits from with to the bits from row write, and returns true if anything changed.

pub fn insert_all_into_row(&mut self, row: R)[src]

Sets every cell in row to true.

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

Gets a slice of the underlying words.

pub fn iter(&self, row: R) -> BitIter<'_, C>

Notable traits for BitIter<'a, T>

impl<'a, T: Idx> Iterator for BitIter<'a, T> type Item = T;
[src]

Iterates through all the columns set to true in a given row of the matrix.

pub fn count(&self, row: R) -> usize[src]

Returns the number of elements in row.

Trait Implementations

impl<R: Clone + Idx, C: Clone + Idx> Clone for BitMatrix<R, C>[src]

fn clone(&self) -> BitMatrix<R, C>[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<R: Idx, C: Idx> Debug for BitMatrix<R, C>[src]

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

Formats the value using the given formatter. Read more

impl<R: Idx, C: Idx, __D: Decoder> Decodable<__D> for BitMatrix<R, C> where
    R: Decodable<__D>,
    C: Decodable<__D>, 
[src]

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

impl<R: Idx, C: Idx, __E: Encoder> Encodable<__E> for BitMatrix<R, C> where
    R: Encodable<__E>,
    C: Encodable<__E>, 
[src]

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

impl<R: PartialEq + Idx, C: PartialEq + Idx> PartialEq<BitMatrix<R, C>> for BitMatrix<R, C>[src]

fn eq(&self, other: &BitMatrix<R, C>) -> bool[src]

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

fn ne(&self, other: &BitMatrix<R, C>) -> bool[src]

This method tests for !=.

impl<R: Eq + Idx, C: Eq + Idx> Eq for BitMatrix<R, C>[src]

impl<R: Idx, C: Idx> StructuralEq for BitMatrix<R, C>[src]

impl<R: Idx, C: Idx> StructuralPartialEq for BitMatrix<R, C>[src]

Auto Trait Implementations

impl<R, C> RefUnwindSafe for BitMatrix<R, C> where
    C: RefUnwindSafe,
    R: RefUnwindSafe

impl<R, C> Send for BitMatrix<R, C> where
    C: Send,
    R: Send

impl<R, C> Sync for BitMatrix<R, C> where
    C: Sync,
    R: Sync

impl<R, C> Unpin for BitMatrix<R, C> where
    C: Unpin,
    R: Unpin

impl<R, C> UnwindSafe for BitMatrix<R, C> where
    C: UnwindSafe,
    R: 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.