Skip to content

Commit

Permalink
Add binding for Bitset::is_empty, bump version to 2.2.0 (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann authored Dec 17, 2024
2 parents 51a6289 + 7069431 commit 1f06335
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ jobs:
cargo +${{ matrix.rust }} minimal-versions test --direct --workspace
if: matrix.rust == 'nightly' && matrix.cargo_features == 'default'

# This only must pass when we're ready to release, allow it to fail unless this is a commit to master
# e.g if we're on a PR that's bumping the -sys crate, and requires changes to the main crate, the minimal version
# check _cannot_ succeed, because the new version of the -sys crate won't be published yet
continue-on-error: ${{ github.ref != 'refs/heads/master' }}

- name: Updated versions
run: cargo update && cargo +${{ matrix.rust }} test --no-default-features --features "${{ matrix.cargo_features }}"
if: matrix.rust == 'stable' && matrix.cargo_features == 'default'
Expand Down
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 1f06335

Please sign in to comment.