[−][src]Struct rustc_ap_rustc_index::bit_set::SparseBitMatrix
A fixed-column-size, variable-row-size 2D bit matrix with a moderately sparse representation.
Initially, every row has no explicit representation. If any bit within a
row is set, the entire row is instantiated as Some(<HybridBitSet>)
.
Furthermore, any previously uninstantiated rows prior to it will be
instantiated as None
. Those prior rows may themselves become fully
instantiated later on if any of their bits are set.
R
and C
are index types used to identify rows and columns respectively;
typically newtyped usize
wrappers, but they can also just be usize
.
Methods
impl<R: Idx, C: Idx> SparseBitMatrix<R, C>
[src]
pub fn new(num_columns: usize) -> Self
[src]
Creates a new empty sparse bit matrix with no rows or columns.
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 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_into_row(&mut self, into: R, from: &HybridBitSet<C>) -> bool
[src]
Union a row, from
, into the into
row.
pub fn insert_all_into_row(&mut self, row: R)
[src]
Insert all bits in the given row.
pub fn rows(&self) -> impl Iterator<Item = R>
[src]
pub fn iter<'a>(&'a self, row: R) -> impl Iterator<Item = C> + 'a
[src]
Iterates through all the columns set to true in a given row of the matrix.
pub fn row(&self, row: R) -> Option<&HybridBitSet<C>>
[src]
Trait Implementations
impl<R: Clone, C: Clone> Clone for SparseBitMatrix<R, C> where
R: Idx,
C: Idx,
[src]
R: Idx,
C: Idx,
fn clone(&self) -> SparseBitMatrix<R, C>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<R: Debug, C: Debug> Debug for SparseBitMatrix<R, C> where
R: Idx,
C: Idx,
[src]
R: Idx,
C: Idx,
Auto Trait Implementations
impl<R, C> RefUnwindSafe for SparseBitMatrix<R, C> where
C: RefUnwindSafe,
C: RefUnwindSafe,
impl<R, C> Send for SparseBitMatrix<R, C> where
C: Send,
C: Send,
impl<R, C> Sync for SparseBitMatrix<R, C> where
C: Sync,
C: Sync,
impl<R, C> Unpin for SparseBitMatrix<R, C> where
C: Unpin,
C: Unpin,
impl<R, C> UnwindSafe for SparseBitMatrix<R, C> where
C: RefUnwindSafe + UnwindSafe,
C: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,