Reuse memory
This commit is contained in:
parent
a21f3a76a9
commit
5248b20d9a
1 changed files with 5 additions and 2 deletions
|
@ -653,13 +653,13 @@ where
|
|||
writeln!(w, r#" edge[{}];"#, content_attrs_str)?;
|
||||
}
|
||||
|
||||
let mut text = Vec::new();
|
||||
for n in g.nodes().iter() {
|
||||
write!(w, " ")?;
|
||||
let id = g.node_id(n);
|
||||
|
||||
let escaped = &g.node_label(n).to_dot_string();
|
||||
|
||||
let mut text = Vec::new();
|
||||
write!(text, "{}", id.as_slice()).unwrap();
|
||||
|
||||
if !options.contains(&RenderOption::NoNodeLabels) {
|
||||
|
@ -677,6 +677,8 @@ where
|
|||
|
||||
writeln!(text, ";").unwrap();
|
||||
w.write_all(&text[..])?;
|
||||
|
||||
text.clear();
|
||||
}
|
||||
|
||||
for e in g.edges().iter() {
|
||||
|
@ -687,7 +689,6 @@ where
|
|||
let source_id = g.node_id(&source);
|
||||
let target_id = g.node_id(&target);
|
||||
|
||||
let mut text = Vec::new();
|
||||
write!(text, "{} -> {}", source_id.as_slice(), target_id.as_slice()).unwrap();
|
||||
|
||||
if !options.contains(&RenderOption::NoEdgeLabels) {
|
||||
|
@ -701,6 +702,8 @@ where
|
|||
|
||||
writeln!(text, ";").unwrap();
|
||||
w.write_all(&text[..])?;
|
||||
|
||||
text.clear();
|
||||
}
|
||||
|
||||
writeln!(w, "}}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue