Returns the number of non null, true values within this array. If you only need to check if there is at least one true value, consider using `has_true()` which can short-circuit and be more efficient.
(&self)
| 159 | /// Returns the number of non null, true values within this array. |
| 160 | /// If you only need to check if there is at least one true value, consider using `has_true()` which can short-circuit and be more efficient. |
| 161 | pub fn true_count(&self) -> usize { |
| 162 | match self.nulls() { |
| 163 | Some(nulls) => { |
| 164 | let null_chunks = nulls.inner().bit_chunks().iter_padded(); |
| 165 | let value_chunks = self.values().bit_chunks().iter_padded(); |
| 166 | null_chunks |
| 167 | .zip(value_chunks) |
| 168 | .map(|(a, b)| (a & b).count_ones() as usize) |
| 169 | .sum() |
| 170 | } |
| 171 | None => self.values().count_set_bits(), |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | /// Returns the number of non null, false values within this array. |
| 176 | /// If you only need to check if there is at least one false value, consider using `has_false()` which can short-circuit and be more efficient. |
no test coverage detected