Grow the tier by doubling its capacity.
(&mut self)
| 68 | |
| 69 | /// Grow the tier by doubling its capacity. |
| 70 | fn grow(&mut self) { |
| 71 | let new_slots = self.total_slots; |
| 72 | let old_total = self.total_slots; |
| 73 | self.total_slots += new_slots; |
| 74 | self.buf.resize(self.total_slots * self.slot_size, 0); |
| 75 | // Push new slot indices onto the free list (reverse order for stack semantics). |
| 76 | for i in (old_total..self.total_slots).rev() { |
| 77 | self.free_list.push(i as u32); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /// Free a slot by index. |
| 82 | fn free(&mut self, slot_idx: u32) { |