Struct dot_writer::Node [−][src]
pub struct Node<'d, 'w> { /* fields omitted */ }Expand description
A Node is returned from Scope::node_named or Scope::node_auto,
and allows for getting the id of the node for future reference via Node::id,
Importantly it also implements Attributes for setting attributes
to override existing defaults for this specific node.
Implementations
Returns a copy of the Node id, for later use with Scope::edge.
Note that as the node definition will not finish writing until after
this Node goes out of scope, you’ll need to save the id if you
want to draw an edge to it later. This function is most usefull when
the edge was automatically generated with Scope::node_auto:
use dot_writer::DotWriter; let mut output_bytes = Vec::new(); { let mut writer = DotWriter::from(&mut output_bytes); writer.set_pretty_print(false); let mut digraph = writer.digraph(); let a_id = { let mut sub_graph = digraph.subgraph(); let a_id = sub_graph.node_auto().id(); // sub_graph goes out of scope here to close bracket // but id is kept for later call a_id }; digraph.edge(a_id, "b"); } assert_eq!( std::str::from_utf8(&output_bytes).unwrap(), "digraph {subgraph {node_0;}node_0->b;}" );
Trait Implementations
type Target = AttributesList<'d, 'w>
type Target = AttributesList<'d, 'w>The resulting type after dereferencing.
Dereferences the value.
Auto Trait Implementations
impl<'d, 'w> !RefUnwindSafe for Node<'d, 'w>impl<'d, 'w> !UnwindSafe for Node<'d, 'w>