Converts all references to other node IDs into new IDs by running the specified function on them. This can be used when changing the IDs of the nodes, for example in the case of generating stable IDs.
(&mut self, f: impl Fn(NodeId) -> NodeId)
| 191 | /// Converts all references to other node IDs into new IDs by running the specified function on them. |
| 192 | /// This can be used when changing the IDs of the nodes, for example in the case of generating stable IDs. |
| 193 | pub fn map_ids(&mut self, f: impl Fn(NodeId) -> NodeId) { |
| 194 | if let ConstructionArgs::Nodes(ids) = &mut self.construction_args { |
| 195 | ids.iter_mut().for_each(|id| *id = f(*id)); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | pub fn unwrap_construction_nodes(&self) -> Vec<NodeId> { |
| 200 | match &self.construction_args { |
no test coverage detected