Struct dot_writer::DotWriter [−][src]
pub struct DotWriter<'w> { /* fields omitted */ }Expand description
Implementations
If set to true, then output will have additional whitespace including newlines and indentation to make the output more human friendly. If false then this will be left out and the output will be more compact. Defaults to true. For example disabled:
use dot_writer::DotWriter; let mut bytes = Vec::new(); let mut writer = DotWriter::from(&mut bytes); writer.set_pretty_print(false); writer.graph().subgraph().cluster().subgraph(); println!("{}", std::str::from_utf8(&bytes).unwrap());
Gives you:
graph {subgraph {subgraph cluster_0 {subgraph {}}}}
While enabled:
use dot_writer::DotWriter; let mut bytes = Vec::new(); let mut writer = DotWriter::from(&mut bytes); // writer.set_pretty_print(false); defaults to true anyway writer.graph().subgraph().cluster().subgraph(); println!("{}", std::str::from_utf8(&bytes).unwrap());
Gives you:
graph {
subgraph {
subgraph cluster_0 {
subgraph {}
}
}
}
Start a new undirection graph. This uses the edge operator --
automatically, which means edges should be rendered without any
arrowheads by default.
use dot_writer::DotWriter; let mut bytes = Vec::new(); let mut writer = DotWriter::from(&mut bytes); writer.set_pretty_print(false); writer.graph().edge("a", "b"); assert_eq!( std::str::from_utf8(&bytes).unwrap(), "graph {a--b;}" );
Start a new directed graph. This uses the edge operator ->
automatically, which means edges should be redered with an
arrow head pointing to the head (end) node.
use dot_writer::DotWriter; let mut bytes = Vec::new(); let mut writer = DotWriter::from(&mut bytes); writer.set_pretty_print(false); writer.digraph().edge("a", "b"); assert_eq!( std::str::from_utf8(&bytes).unwrap(), "digraph {a->b;}" );
Trait Implementations
Auto Trait Implementations
impl<'w> !RefUnwindSafe for DotWriter<'w>impl<'w> !UnwindSafe for DotWriter<'w>