MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / dec

Method dec

aiscript-arena/src/dynamic_roots.rs:299–314  ·  view source on GitHub ↗
(&mut self, idx: Index)

Source from the content-addressed store, hash-verified

297 }
298
299 fn dec(&mut self, idx: Index) {
300 let slot = &mut self.slots[idx];
301 match slot {
302 Slot::Occupied { ref_count, .. } => {
303 if *ref_count == 0 {
304 *slot = Slot::Vacant {
305 next_free: self.next_free,
306 };
307 self.next_free = idx;
308 } else {
309 *ref_count -= 1;
310 }
311 }
312 Slot::Vacant { .. } => panic!("taken slot has been improperly freed"),
313 }
314 }
315}

Callers 1

dropMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected