Remove a node and invalidate old ids for that slot. Successful removal bumps the slot generation and pushes the slot onto the free list for later reuse.
(&mut self, id: NodeID)
| 221 | .expect("tracked node slot stays live while borrowed") |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | impl DerefMut for NodeMut<'_> { |
| 226 | fn deref_mut(&mut self) -> &mut Self::Target { |
| 227 | self.arena.nodes[self.index] |
| 228 | .as_mut() |
| 229 | .expect("tracked node slot stays live while borrowed") |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | impl Drop for NodeMut<'_> { |
| 234 | fn drop(&mut self) { |
| 235 | let (new_name_hash, name_empty, new_tags_hash, new_parent, new_node_type, children_changed) = { |
| 236 | let node = self.arena.nodes[self.index] |
| 237 | .as_ref() |
| 238 | .expect("tracked node slot stays live while borrowed"); |
| 239 | ( |
| 240 | string_to_u64(node.get_name()), |
| 241 | node.get_name().is_empty(), |
| 242 | tags_hash(&node.tags), |