MCPcopy Create free account
hub / github.com/chc4/lineiform / add_node

Method add_node

tangle/src/region.rs:130–143  ·  view source on GitHub ↗
(&mut self, token: &mut NodeOwner, mut n: T,
        f: F)

Source from the content-addressed store, hash-verified

128 }
129
130 pub fn add_node<T, F, F_O>(&mut self, token: &mut NodeOwner, mut n: T,
131 f: F) -> (NodeIdx, F_O) where F: FnOnce(&mut Node, &mut Region) -> F_O, T: NodeBehavior + 'static {
132 use std::rc::Rc;
133 let mut n = Node::new(token, box n as Box<dyn NodeBehavior>);
134 n.containing_region = Some(self.idx);
135 n.create_ports(token, self);
136 let f_o = f(&mut n, self);
137 let idx = self.nodes.add_node(n);
138 // Now we can attach the ports to the actual node
139 for port in self.nodes[idx].ports() {
140 self.ports[port].node = Some(idx);
141 }
142 (idx, f_o)
143 }
144
145 pub fn add_port(&mut self) -> PortIdx {
146 let p = Port::new();

Callers 6

add_bodyMethod · 0.80
newMethod · 0.80
new_regionMethod · 0.80
add_functionMethod · 0.80
add_portMethod · 0.80

Calls 2

portsMethod · 0.80
create_portsMethod · 0.45

Tested by

no test coverage detected