(handle: u32)
| 184 | } |
| 185 | |
| 186 | pub fn destroy(handle: u32) { |
| 187 | with(|inner| { |
| 188 | let existed = if let Some(slot) = inner.nodes.get_mut(handle as usize) { |
| 189 | if slot.is_some() { *slot = None; true } else { false } |
| 190 | } else { false }; |
| 191 | if existed { inner.destroyed_queue.push(handle); } |
| 192 | // Any node with this as parent becomes a root — flag PARENT dirty |
| 193 | // so Swift reparents it. |
| 194 | for n in inner.nodes.iter_mut().flatten() { |
| 195 | if n.parent == handle { |
| 196 | n.parent = 0; |
| 197 | n.dirty_flags |= DIRTY_PARENT; |
| 198 | } |
| 199 | } |
| 200 | }); |
| 201 | } |
| 202 | |
| 203 | fn mutate<F: FnOnce(&mut Node)>(handle: u32, f: F) { |
| 204 | with(|inner| { |
no test coverage detected