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

Method swap

crates/vm/src/object/ext.rs:330–334  ·  view source on GitHub ↗
(&self, pyref: PyRef<T>)

Source from the content-addressed store, hash-verified

328 /// until no more reference can be used via PyAtomicRef::deref()
329 #[must_use]
330 pub unsafe fn swap(&self, pyref: PyRef<T>) -> PyRef<T> {
331 let py = PyRef::leak(pyref) as *const Py<T> as *mut _;
332 let old = Radium::swap(&self.inner, py, Ordering::AcqRel);
333 unsafe { PyRef::from_raw(old.cast()) }
334 }
335
336 pub fn swap_to_temporary_refs(&self, pyref: PyRef<T>, vm: &VirtualMachine) {
337 let old = unsafe { self.swap(pyref) };

Callers 15

getMethod · 0.45
close_handleMethod · 0.45
initMethod · 0.45
reset_factoriesMethod · 0.45
cursorMethod · 0.45
set_isolation_levelMethod · 0.45
set_text_factoryMethod · 0.45
set_row_factoryMethod · 0.45
executeMethod · 0.45
step_row_else_doneMethod · 0.45

Calls 7

leakFunction · 0.85
newFunction · 0.85
castMethod · 0.45
mapMethod · 0.45
as_refMethod · 0.45
into_rawMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected