[−][src]Struct rustc_data_structures::bit_set::BitMatrix
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.
Methods
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 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).
ⓘImportant traits for BitIter<'a, T>pub fn iter<'a>(&'a self, row: R) -> BitIter<'a, C>
[src]
Iterates through all the columns set to true in a given row of the matrix.
Trait Implementations
impl<R: Clone + Idx, C: Clone + Idx> Clone for BitMatrix<R, C>
[src]
fn clone(&self) -> BitMatrix<R, C>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<R: Debug + Idx, C: Debug + Idx> Debug for BitMatrix<R, C>
[src]
Auto Trait Implementations
impl<R, C> Send for BitMatrix<R, C> where
C: Send,
R: Send,
C: Send,
R: Send,
impl<R, C> Sync for BitMatrix<R, C> where
C: Sync,
R: Sync,
C: Sync,
R: Sync,
Blanket Implementations
impl<T> Erased for T
[src]
impl<T> Send for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
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 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Ifn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
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]
T: 'static + ?Sized,