Macro dot_parser_macros::from_dot_string

source ยท
from_dot_string!() { /* proc-macro */ }
Expand description

Similar to from_dot_file!, but reads the DOT graph from a given literal instead of reading it from a file.

use dot_parser_macros::from_dot_string;
use petgraph::graph::Graph as PetGraph;
use dot_parser::canonical::Graph as CanonicalGraph;

let petgraph: PetGraph<_, _> =
    CanonicalGraph::from(from_dot_string!("digraph { A -> B}")).into();
println!("{:#?}", petgraph);