MCPcopy Create free account
hub / github.com/PRQL/prql / visit

Method visit

prqlc/prqlc/src/utils/toposort.rs:60–80  ·  view source on GitHub ↗
(&mut self, dag: &Dag, n: usize)

Source from the content-addressed store, hash-verified

58
59impl Toposort {
60 fn visit(&mut self, dag: &Dag, n: usize) -> Result<(), ()> {
61 let node = self.nodes.get_mut(n).unwrap();
62 if node.done {
63 return Ok(());
64 }
65 if node.visiting {
66 return Err(());
67 }
68 node.visiting = true;
69
70 for m in &dag[n] {
71 self.visit(dag, *m)?;
72 }
73
74 let node = self.nodes.get_mut(n).unwrap();
75 node.visiting = false;
76 node.done = true;
77 self.order.push(n);
78
79 Ok(())
80 }
81}
82
83#[cfg(test)]

Callers 1

toposortFunction · 0.80

Calls 2

get_mutMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected