if edge `from--|weight|-->to` not exists, then add the edge and return true
(
&mut self,
from: ConstraintNode<'tcx>,
to: ConstraintNode<'tcx>,
weight: ConstraintEdge,
)
| 384 | /// if edge `from--|weight|-->to` not exists, |
| 385 | /// then add the edge and return true |
| 386 | fn insert_edge( |
| 387 | &mut self, |
| 388 | from: ConstraintNode<'tcx>, |
| 389 | to: ConstraintNode<'tcx>, |
| 390 | weight: ConstraintEdge, |
| 391 | ) -> bool { |
| 392 | let from = self.get_node(&from).unwrap(); |
| 393 | let to = self.get_node(&to).unwrap(); |
| 394 | if let Some(edge) = self.graph.find_edge(from, to) { |
| 395 | if let Some(w) = self.graph.edge_weight(edge) { |
| 396 | if *w == weight { |
| 397 | return false; |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | self.graph.add_edge(from, to, weight); |
| 402 | true |
| 403 | } |
| 404 | |
| 405 | /// Print the callgraph in dot format. |
| 406 | #[allow(dead_code)] |