MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / drain

Method drain

crates/core/src/slab.rs:491–502  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

489 /// Iteration order is undefined.
490 #[inline]
491 pub fn drain(&mut self) -> impl Iterator<Item = (Id, T)> + '_ {
492 assert!(self.entries.len() <= Self::MAX_CAPACITY);
493 self.len = 0;
494 self.free = None;
495 self.entries
496 .drain(..)
497 .enumerate()
498 .filter_map(|(i, e)| match e {
499 Entry::Occupied(x) => Some((Id(EntryIndex::new(i)), x)),
500 Entry::Free { .. } => None,
501 })
502 }
503
504 /// Clear all of the values from inside this slab.
505 ///

Callers 15

joinMethod · 0.45
rewriteMethod · 0.45
add_ruleMethod · 0.45
do_remove_constant_phisFunction · 0.45
finish_ir_instMethod · 0.45
clearMethod · 0.45
optimize_pure_enodeMethod · 0.45
elaborate_blockMethod · 0.45
translate_const_exprMethod · 0.45

Calls 2

IdClass · 0.70
newFunction · 0.50

Tested by

no test coverage detected