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

Method exec

flow-rs/tests/nodes_ext.rs:18–41  ·  view source on GitHub ↗
(&mut self, _: &Context)

Source from the content-addressed store, hash-verified

16 async fn initialize(&mut self, _: ResourceCollection) {}
17 async fn finalize(&mut self) {}
18 async fn exec(&mut self, _: &Context) -> Result<()> {
19 let mut recv_a = FuturesUnordered::new();
20 recv_a.push(self.a.recv_any());
21 let mut recv_b = FuturesUnordered::new();
22 recv_b.push(self.b.recv_any());
23 loop {
24 select! {
25 a = recv_a.select_next_some() => {
26 if let Ok(a) = a {
27 self.c.send_any(a).await.ok();
28 recv_a.push(self.a.recv_any());
29 }
30 }
31 b = recv_b.select_next_some() => {
32 if let Ok(b) = b {
33 self.c.send_any(b).await.ok();
34 recv_b.push(self.b.recv_any());
35 }
36 }
37 complete => break,
38 }
39 }
40 Ok(())
41 }
42}
43
44node_register!("BinaryOpr", BinaryOpr);

Callers

nothing calls this directly

Calls 3

pushMethod · 0.80
recv_anyMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected