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

Method dec

crates/common/src/refcount.rs:148–161  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

146 #[inline]
147 #[must_use]
148 pub fn dec(&self) -> bool {
149 let old = State::from_raw(self.state.fetch_sub(COUNT, Ordering::Release));
150
151 // LEAKED objects never reach 0
152 if old.leaked() {
153 return false;
154 }
155
156 if old.strong() == 1 {
157 core::sync::atomic::fence(Ordering::Acquire);
158 return true;
159 }
160 false
161 }
162
163 /// Mark this object as leaked (interned). It will never be deallocated.
164 pub fn leak(&self) {

Callers 2

call_slot_delMethod · 0.45
dropMethod · 0.45

Calls 2

leakedMethod · 0.80
strongMethod · 0.80

Tested by

no test coverage detected