MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / next

Method next

crates/table/src/fixed_bit_set.rs:304–319  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

302 type Item = usize;
303
304 fn next(&mut self) -> Option<Self::Item> {
305 loop {
306 let tz = self.curr.trailing_zeros();
307 if tz < B::BITS {
308 // Some bit was set; so yield the index of that
309 // and zero the bit out so we don't yield it again.
310 self.curr &= self.curr.wrapping_sub(B::ONE);
311 let idx = self.block_idx as u32 * B::BITS + tz;
312 return Some(idx as usize);
313 } else {
314 // No bit is set; advance to the next block, or quit if none left.
315 self.curr = *self.inner.next()?;
316 self.block_idx += 1;
317 }
318 }
319 }
320}
321
322#[cfg(test)]

Callers 2

iter_setMethod · 0.45
iter_set_fromMethod · 0.45

Calls 2

trailing_zerosMethod · 0.80
wrapping_subMethod · 0.80

Tested by

no test coverage detected