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

Method set

crates/common/src/atomic.rs:77–88  ·  view source on GitHub ↗
(&self, value: NonNull<T>)

Source from the content-addressed store, hash-verified

75 }
76
77 pub fn set(&self, value: NonNull<T>) -> Result<(), NonNull<T>> {
78 let exchange = self.inner.compare_exchange(
79 ptr::null_mut(),
80 value.as_ptr(),
81 Ordering::AcqRel,
82 Ordering::Acquire,
83 );
84 match exchange {
85 Ok(_) => Ok(()),
86 Err(_) => Err(value),
87 }
88 }
89
90 pub fn get_or_init<F>(&self, f: F) -> NonNull<T>
91 where

Callers 14

set_errnoFunction · 0.45
dropMethod · 0.45
with_deferred_dropsFunction · 0.45
lockMethod · 0.45
try_lockMethod · 0.45
unlockMethod · 0.45
lock_exclusiveMethod · 0.45
try_lock_exclusiveMethod · 0.45
unlock_exclusiveMethod · 0.45
downgradeMethod · 0.45
try_upgradeMethod · 0.45

Calls 2

ErrClass · 0.50
as_ptrMethod · 0.45

Tested by

no test coverage detected