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

Method extend

cranelift/entity/src/list.rs:466–484  ·  view source on GitHub ↗

Appends multiple elements to the back of the list.

(&mut self, elements: I, pool: &mut ListPool<T>)

Source from the content-addressed store, hash-verified

464
465 /// Appends multiple elements to the back of the list.
466 pub fn extend<I>(&mut self, elements: I, pool: &mut ListPool<T>)
467 where
468 I: IntoIterator<Item = T>,
469 {
470 let iterator = elements.into_iter();
471 let (len, upper) = iterator.size_hint();
472 // On most iterators this check is optimized down to `true`.
473 if upper == Some(len) {
474 let data = self.grow(len, pool);
475 let offset = data.len() - len;
476 for (src, dst) in iterator.zip(data[offset..].iter_mut()) {
477 *dst = src;
478 }
479 } else {
480 for x in iterator {
481 self.push(x, pool);
482 }
483 }
484 }
485
486 /// Copies a slice from an entity list in the same pool to a position in this one.
487 ///

Callers 15

push_frameMethod · 0.45
listFunction · 0.45
solve_constraintsFunction · 0.45
ctor_BMethod · 0.45
remove_set_ofMethod · 0.45
terms_in_cyclesFunction · 0.45
taggedMethod · 0.45
fitsMethod · 0.45
to_sexprMethod · 0.45
reportMethod · 0.45

Calls 6

into_iterMethod · 0.45
size_hintMethod · 0.45
growMethod · 0.45
lenMethod · 0.45
iter_mutMethod · 0.45
pushMethod · 0.45

Tested by 1

pushFunction · 0.36