1
Fork 0

Merge WithNumNodes into DirectedGraph

This commit is contained in:
Maybe Waffle 2024-04-14 15:15:03 +00:00
parent 029cb1b13b
commit 398da593a5
13 changed files with 33 additions and 52 deletions

View file

@ -141,9 +141,7 @@ impl<'tcx> std::ops::Deref for BasicBlocks<'tcx> {
impl<'tcx> graph::DirectedGraph for BasicBlocks<'tcx> {
type Node = BasicBlock;
}
impl<'tcx> graph::WithNumNodes for BasicBlocks<'tcx> {
#[inline]
fn num_nodes(&self) -> usize {
self.basic_blocks.len()

View file

@ -5,7 +5,7 @@ use std::io::{self, Write};
pub struct GraphvizWriter<
'a,
G: graph::DirectedGraph + graph::WithSuccessors + graph::WithStartNode + graph::WithNumNodes,
G: graph::DirectedGraph + graph::WithSuccessors + graph::WithStartNode,
NodeContentFn: Fn(<G as graph::DirectedGraph>::Node) -> Vec<String>,
EdgeLabelsFn: Fn(<G as graph::DirectedGraph>::Node) -> Vec<String>,
> {
@ -19,7 +19,7 @@ pub struct GraphvizWriter<
impl<
'a,
G: graph::DirectedGraph + graph::WithSuccessors + graph::WithStartNode + graph::WithNumNodes,
G: graph::DirectedGraph + graph::WithSuccessors + graph::WithStartNode,
NodeContentFn: Fn(<G as graph::DirectedGraph>::Node) -> Vec<String>,
EdgeLabelsFn: Fn(<G as graph::DirectedGraph>::Node) -> Vec<String>,
> GraphvizWriter<'a, G, NodeContentFn, EdgeLabelsFn>