pub struct igraph_bitset_t { /* private fields */ }Implementations§
Source§impl igraph_bitset_t
impl igraph_bitset_t
Sourcepub fn new(len: usize) -> Self
pub fn new(len: usize) -> Self
Creates a bitset of len bits, all zero
(igraph_bitset_init).
Sourcepub fn from_bools(bits: &[bool]) -> Self
pub fn from_bools(bits: &[bool]) -> Self
Creates a bitset from a slice of booleans (bits[i] is bit i).
Sourcepub fn from_ones(len: usize, ones: impl IntoIterator<Item = usize>) -> Self
pub fn from_ones(len: usize, ones: impl IntoIterator<Item = usize>) -> Self
Creates a bitset of len bits where exactly the listed positions are
set.
§Panics
If a position is >= len.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of bits
(igraph_bitset_size).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the bitset has no bits at all (not whether all bits are zero:
see none).
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Number of bits that fit in the allocated storage
(igraph_bitset_capacity).
Sourcepub fn reserve(&mut self, capacity: usize)
pub fn reserve(&mut self, capacity: usize)
Reserves storage for at least capacity bits in total
(igraph_bitset_reserve).
Sourcepub fn resize(&mut self, len: usize)
pub fn resize(&mut self, len: usize)
Changes the number of bits; new bits are zero
(igraph_bitset_resize).
Sourcepub fn count_ones(&self) -> usize
pub fn count_ones(&self) -> usize
Number of set bits (the population count)
(igraph_bitset_popcount).
Sourcepub fn count_zeros(&self) -> usize
pub fn count_zeros(&self) -> usize
Number of zero bits.
Sourcepub fn leading_zeros(&self) -> usize
pub fn leading_zeros(&self) -> usize
Number of zeros before the first one, starting from the most
significant bit (len if all zero)
(igraph_bitset_countl_zero).
Sourcepub fn leading_ones(&self) -> usize
pub fn leading_ones(&self) -> usize
Number of ones before the first zero, starting from the most
significant bit
(igraph_bitset_countl_one).
Sourcepub fn trailing_zeros(&self) -> usize
pub fn trailing_zeros(&self) -> usize
Number of zeros before the first one, starting from bit 0 (len if
all zero); i.e. the index of the first set bit
(igraph_bitset_countr_zero).
Sourcepub fn trailing_ones(&self) -> usize
pub fn trailing_ones(&self) -> usize
Number of ones before the first zero, starting from bit 0
(igraph_bitset_countr_one).
Sourcepub fn all(&self) -> bool
pub fn all(&self) -> bool
Whether all bits are one (true for an empty bitset)
(igraph_bitset_is_all_one).
Sourcepub fn any(&self) -> bool
pub fn any(&self) -> bool
Whether some bit is one
(igraph_bitset_is_any_one).
Sourcepub fn none(&self) -> bool
pub fn none(&self) -> bool
Whether all bits are zero (true for an empty bitset)
(igraph_bitset_is_all_zero).
Sourcepub fn not_all(&self) -> bool
pub fn not_all(&self) -> bool
Whether some bit is zero
(igraph_bitset_is_any_zero).
Sourcepub fn fill(&mut self, value: bool)
pub fn fill(&mut self, value: bool)
Sets every bit to value
(igraph_bitset_fill).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Sets every bit to zero, keeping the length
(igraph_bitset_null).
Sourcepub fn iter_ones(&self) -> impl Iterator<Item = usize> + '_
pub fn iter_ones(&self) -> impl Iterator<Item = usize> + '_
Iterates over the positions of the set bits, in increasing order, skipping whole zero words.
Sourcepub fn complement(&self) -> Self
pub fn complement(&self) -> Self
Bitwise complement (igraph_bitset_not).
Sourcepub fn update(&mut self, other: &Self)
pub fn update(&mut self, other: &Self)
Replaces the content with a copy of other, reusing the storage
when possible (igraph_bitset_update).
Trait Implementations§
Source§impl BitAnd for &igraph_bitset_t
impl BitAnd for &igraph_bitset_t
Source§fn bitand(self, rhs: Self) -> igraph_bitset_t
fn bitand(self, rhs: Self) -> igraph_bitset_t
§Panics
If the lengths differ.
Source§type Output = igraph_bitset_t
type Output = igraph_bitset_t
& operator.Source§impl BitAndAssign<&igraph_bitset_t> for igraph_bitset_t
impl BitAndAssign<&igraph_bitset_t> for igraph_bitset_t
Source§fn bitand_assign(&mut self, rhs: &igraph_bitset_t)
fn bitand_assign(&mut self, rhs: &igraph_bitset_t)
§Panics
If the lengths differ.
Source§impl BitOr for &igraph_bitset_t
impl BitOr for &igraph_bitset_t
Source§fn bitor(self, rhs: Self) -> igraph_bitset_t
fn bitor(self, rhs: Self) -> igraph_bitset_t
§Panics
If the lengths differ.
Source§type Output = igraph_bitset_t
type Output = igraph_bitset_t
| operator.Source§impl BitOrAssign<&igraph_bitset_t> for igraph_bitset_t
impl BitOrAssign<&igraph_bitset_t> for igraph_bitset_t
Source§fn bitor_assign(&mut self, rhs: &igraph_bitset_t)
fn bitor_assign(&mut self, rhs: &igraph_bitset_t)
§Panics
If the lengths differ.
Source§impl BitXor for &igraph_bitset_t
impl BitXor for &igraph_bitset_t
Source§fn bitxor(self, rhs: Self) -> igraph_bitset_t
fn bitxor(self, rhs: Self) -> igraph_bitset_t
§Panics
If the lengths differ.
Source§type Output = igraph_bitset_t
type Output = igraph_bitset_t
^ operator.Source§impl BitXorAssign<&igraph_bitset_t> for igraph_bitset_t
impl BitXorAssign<&igraph_bitset_t> for igraph_bitset_t
Source§fn bitxor_assign(&mut self, rhs: &igraph_bitset_t)
fn bitxor_assign(&mut self, rhs: &igraph_bitset_t)
§Panics
If the lengths differ.
Source§impl Clone for igraph_bitset_t
impl Clone for igraph_bitset_t
Source§impl Debug for igraph_bitset_t
impl Debug for igraph_bitset_t
Source§impl Display for igraph_bitset_t
impl Display for igraph_bitset_t
Source§impl Drop for igraph_bitset_t
impl Drop for igraph_bitset_t
impl Eq for igraph_bitset_t
Source§impl Extend<igraph_bitset_t> for igraph_bitset_list_t
impl Extend<igraph_bitset_t> for igraph_bitset_list_t
Source§fn extend<I: IntoIterator<Item = igraph_bitset_t>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = igraph_bitset_t>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<&[bool]> for igraph_bitset_t
impl From<&[bool]> for igraph_bitset_t
Source§impl From<&igraph_bitset_t> for Vec<bool>
impl From<&igraph_bitset_t> for Vec<bool>
Source§fn from(b: &igraph_bitset_t) -> Self
fn from(b: &igraph_bitset_t) -> Self
Source§impl FromIterator<bool> for igraph_bitset_t
impl FromIterator<bool> for igraph_bitset_t
Source§impl FromIterator<igraph_bitset_t> for igraph_bitset_list_t
impl FromIterator<igraph_bitset_t> for igraph_bitset_list_t
Source§fn from_iter<I: IntoIterator<Item = igraph_bitset_t>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = igraph_bitset_t>>(iter: I) -> Self
Source§impl Not for &igraph_bitset_t
impl Not for &igraph_bitset_t
Source§type Output = igraph_bitset_t
type Output = igraph_bitset_t
! operator.Source§fn not(self) -> igraph_bitset_t
fn not(self) -> igraph_bitset_t
! operation. Read more