MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / new

Method new

flow-rs/src/graph/mod.rs:45–66  ·  view source on GitHub ↗
(
        mut graph: Graph,
        global_ctx: Context,
        global_resources: ResourceCollection,
    )

Source from the content-addressed store, hash-verified

43
44impl MainGraph {
45 pub(crate) fn new(
46 mut graph: Graph,
47 global_ctx: Context,
48 global_resources: ResourceCollection,
49 ) -> MainGraph {
50 let mut v = vec![];
51 for name in &graph.inputs {
52 v.push((name.clone(), graph.conns[name].make()));
53 }
54 for name in &graph.outputs {
55 v.push((name.clone(), graph.conns[name].make()));
56 }
57
58 for (name, conn) in v {
59 graph.set_port(name.as_str(), None, &conn);
60 }
61 MainGraph {
62 graph,
63 global_ctx,
64 global_resources,
65 }
66 }
67 /// Get an input port from the graph by name
68 pub fn input(&self, name: &str) -> Option<Sender> {
69 self.graph.conns.get(name).map(|x| x.get().sender())

Callers

nothing calls this directly

Calls 4

pushMethod · 0.80
makeMethod · 0.80
cloneMethod · 0.45
set_portMethod · 0.45

Tested by

no test coverage detected