MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / map_ids

Method map_ids

node-graph/graph-craft/src/proto.rs:193–197  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 2

replace_node_idMethod · 0.45
reorder_idsMethod · 0.45

Calls 1

iter_mutMethod · 0.45

Tested by

no test coverage detected