diff options
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 { |
