Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add binding for Bitset::is_empty, bump version to 2.2.0 #163

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading