(&self, index: u32, generation: u32)
| 33 | |
| 34 | #[derive(Default)] |
| 35 | struct SlotArena { |
| 36 | generations: Vec<u32>, |
| 37 | occupied: Vec<bool>, |
| 38 | free_slots: Vec<usize>, |
| 39 | } |
| 40 | |
| 41 | impl SlotArena { |
| 42 | #[inline] |
| 43 | fn create_parts(&mut self) -> (u32, u32) { |
| 44 | if let Some(slot) = self.free_slots.pop() { |
| 45 | self.generations[slot] = self.generations[slot].wrapping_add(1); |
| 46 | self.occupied[slot] = true; |
| 47 | return ((slot + 1) as u32, self.generations[slot]); |
| 48 | } |
| 49 |
no test coverage detected