@@ -19,6 +19,8 @@ impl std::fmt::Display for Edge {
19
19
}
20
20
}
21
21
22
+ /// [`DotWriter`] is responsible for drawing SDDs and vtrees
23
+ /// in the .DOT Graphviz format.
22
24
#[ derive( Default ) ]
23
25
pub struct DotWriter {
24
26
graph_name : String ,
@@ -29,19 +31,17 @@ pub struct DotWriter {
29
31
}
30
32
31
33
#[ derive( Debug ) ]
32
- pub enum NodeType {
33
- Box ( String ) ,
34
+ pub ( crate ) enum NodeType {
34
35
Circle ( String , Option < usize > ) ,
35
- CircleStr ( String , u32 ) ,
36
36
Record ( String , String ) ,
37
37
}
38
38
39
39
impl NodeType {
40
40
fn shape ( & self ) -> String {
41
41
let shape_type = match self {
42
- NodeType :: Box ( _) => "box" ,
42
+ // NodeType::Box(_) => "box",
43
43
NodeType :: Record ( _, _) => "record" ,
44
- NodeType :: Circle ( _, _) | NodeType :: CircleStr ( _ , _ ) => "circle" ,
44
+ NodeType :: Circle ( _, _) => "circle" ,
45
45
}
46
46
. to_owned ( ) ;
47
47
@@ -55,8 +55,6 @@ impl NodeType {
55
55
format ! ( "label=<{label}>, xlabel=<<FONT POINT-SIZE=\" 7\" >{idx}</FONT>>, fillcolor=white, style=filled" )
56
56
}
57
57
NodeType :: Circle ( label, _) => format ! ( "label=<{label}>" ) ,
58
- NodeType :: CircleStr ( label, idx) => format ! ( "label=\" {label} ({idx})\" " ) ,
59
- NodeType :: Box ( _) => String :: new ( ) ,
60
58
}
61
59
}
62
60
@@ -67,19 +65,19 @@ impl NodeType {
67
65
68
66
impl DotWriter {
69
67
#[ must_use]
70
- pub fn new ( graph_name : String , show_ids : bool ) -> DotWriter {
68
+ pub ( crate ) fn new ( graph_name : String , show_ids : bool ) -> DotWriter {
71
69
DotWriter {
72
70
graph_name,
73
71
show_ids,
74
72
..Default :: default ( )
75
73
}
76
74
}
77
75
78
- pub fn add_node ( & mut self , node_idx : usize , node_type : NodeType ) {
76
+ pub ( crate ) fn add_node ( & mut self , node_idx : usize , node_type : NodeType ) {
79
77
self . nodes . push ( ( node_idx, node_type) ) ;
80
78
}
81
79
82
- pub fn add_edge ( & mut self , edge : Edge ) {
80
+ pub ( crate ) fn add_edge ( & mut self , edge : Edge ) {
83
81
for other in & self . edges {
84
82
if * other == edge {
85
83
// We have already added this edge.
@@ -92,7 +90,7 @@ impl DotWriter {
92
90
93
91
/// # Errors
94
92
/// Function returns an error if the writing to a file or flushing fails.
95
- pub fn write ( & self , writer : & mut dyn std:: io:: Write ) -> Result < ( ) , String > {
93
+ pub ( crate ) fn write ( & self , writer : & mut dyn std:: io:: Write ) -> Result < ( ) , String > {
96
94
write ! (
97
95
writer,
98
96
"digraph {} {{\n overlap=false\n ordering=out" ,
0 commit comments