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

Method deep_clone

cranelift/entity/src/list.rs:350–365  ·  view source on GitHub ↗

Create a deep clone of the list, which does not alias the original list.

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

Source from the content-addressed store, hash-verified

348
349 /// Create a deep clone of the list, which does not alias the original list.
350 pub fn deep_clone(&self, pool: &mut ListPool<T>) -> Self {
351 match pool.len_of(self) {
352 None => return Self::new(),
353 Some(len) => {
354 let src = self.index as usize;
355 let block = pool.alloc(sclass_for_length(len));
356 pool.data[block] = T::new(len);
357 pool.data.copy_within(src..src + len, block + 1);
358
359 Self {
360 index: (block + 1) as u32,
361 unused: PhantomData,
362 }
363 }
364 }
365 }
366
367 /// Removes all elements from the list.
368 ///

Callers 1

deep_cloneFunction · 0.45

Calls 5

sclass_for_lengthFunction · 0.85
len_ofMethod · 0.80
copy_withinMethod · 0.80
newFunction · 0.50
allocMethod · 0.45

Tested by 1

deep_cloneFunction · 0.36