MCPcopy Index your code
hub / github.com/RustPython/RustPython / clone

Method clone

crates/compiler-core/src/bytecode.rs:548–567  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

546
547impl Clone for CodeUnits {
548 fn clone(&self) -> Self {
549 // SAFETY: No concurrent mutation during clone — cloning is only done
550 // during code object construction or marshaling, not while instrumented.
551 let units = unsafe { &*self.units.get() }.clone();
552 let adaptive_counters = self
553 .adaptive_counters
554 .iter()
555 .map(|c| AtomicU16::new(c.load(Ordering::Relaxed)))
556 .collect();
557 let pointer_cache = self
558 .pointer_cache
559 .iter()
560 .map(|c| AtomicUsize::new(c.load(Ordering::Relaxed)))
561 .collect();
562 Self {
563 units: UnsafeCell::new(units),
564 adaptive_counters,
565 pointer_cache,
566 }
567 }
568}
569
570impl fmt::Debug for CodeUnits {

Callers 6

_compile_symtableFunction · 0.45
deserialize_value_depthFunction · 0.45
deserialize_value_typedFunction · 0.45
split_localplusFunction · 0.45
to_ownedMethod · 0.45
map_clone_bagMethod · 0.45

Calls 6

newFunction · 0.85
collectMethod · 0.80
getMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected