pub struct BitMatrix<R: Idx, C: Idx> { /* fields omitted */ }
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.
Create a new rows x columns
matrix, initially empty.
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, and false otherwise.
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
?
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).
Add the bits from row read
to the bits from row write
,
return 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).
Iterates through all the columns set to true in a given row of
the matrix.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more