Skip to content

Commit

Permalink
feat: Bitset::is_empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed Dec 17, 2024
1 parent f9fa31d commit 7069431
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions croaring/src/bitset/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,23 @@ impl Bitset {
(word & mask) != 0
}

/// Check if the bitset is empty
///
/// # Examples
/// ```
/// use croaring::Bitset;
/// let mut bitset = Bitset::new();
/// assert!(bitset.is_empty());
/// bitset.set(100);
/// assert!(!bitset.is_empty());
/// ```
#[inline]
#[doc(alias = "bitset_empty")]
#[must_use]
pub fn is_empty(&self) -> bool {
unsafe { ffi::bitset_empty(&self.bitset) }
}

/// Count of number of set bits
///
/// # Examples
Expand Down

0 comments on commit 7069431

Please sign in to comment.