diff options
| author | mat <git@matdoes.dev> | 2025-09-20 20:35:16 -1200 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-09-20 20:35:16 -1200 |
| commit | 585b51e91a5335eae37bc5af7c0111bb2092b156 (patch) | |
| tree | c1559014df9db20dd625d9fe972d4e9f88317008 /azalea-core/src/bitset.rs | |
| parent | db793448ff8e656ad80859835edc3b89cb547dd2 (diff) | |
| download | azalea-drasl-585b51e91a5335eae37bc5af7c0111bb2092b156.tar.xz | |
more accurate mining and impl PartialEq for packets
Diffstat (limited to 'azalea-core/src/bitset.rs')
| -rw-r--r-- | azalea-core/src/bitset.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/azalea-core/src/bitset.rs b/azalea-core/src/bitset.rs index 2c42b4c2..7324501a 100644 --- a/azalea-core/src/bitset.rs +++ b/azalea-core/src/bitset.rs @@ -134,7 +134,7 @@ impl BitSet { /// Returns the indices of all bits that are set to `true`. pub fn iter_ones(&self) -> impl Iterator<Item = usize> { - (0..self.len()).filter_map(|i| if self.index(i) { Some(i) } else { None }) + (0..self.len()).filter(|i| self.index(*i)) } /// Returns the maximum number of items that could be in this `BitSet`. @@ -144,6 +144,13 @@ impl BitSet { pub fn len(&self) -> usize { self.data.len() * 64 } + + /// Returns true if the `BitSet` was created with a size of 0. + /// + /// Equivalent to `self.len() == 0`. + pub fn is_empty(&self) -> bool { + self.len() == 0 + } } impl From<Vec<u64>> for BitSet { |
