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

Method inc

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

Source from the content-addressed store, hash-verified

98 /// Increment strong count
99 #[inline]
100 pub fn inc(&self) {
101 let val = State::from_raw(self.state.fetch_add(COUNT, Ordering::Relaxed));
102 if val.destructed() || (val.strong() as usize) > STRONG - 1 {
103 refcount_overflow();
104 }
105 if val.strong() == 0 {
106 // The previous fetch_add created a permission to run decrement again
107 self.state.fetch_add(COUNT, Ordering::Relaxed);
108 }
109 }
110
111 #[inline]
112 pub fn inc_by(&self, n: usize) {

Callers 3

to_ownedMethod · 0.45
promoteMethod · 0.45
init_type_hierarchyFunction · 0.45

Calls 3

refcount_overflowFunction · 0.85
destructedMethod · 0.80
strongMethod · 0.80

Tested by

no test coverage detected