dot parser in Rust implemented with FFI to Graphviz cgraph library.
dot-graph parses a dot format file using C bindings to Graphviz (v7.0.6).
The system environment should be able to find and include the following header files.
#include <gvc.h>
#include <cgraph.h>Coming from Linux,
$ sudo apt install graphviz-devAnd coming from vanilla Ubuntu, you may want to install these too.
$ sudo apt install build-essentials cmake
$ sudo apt install clangComing from Mac,
$ brew install graphvizAnd coming from Apple Silicon Mac, and add an environment variable,
export CPATH=/opt/homebrew/includeOr, try building from the source code yourself following the guide.
use dot_graph::prelude::*;
fn main() -> Result<(), DotGraphError> {
/* parse from file */
let graph = parser::parse_from_file(/* path */)?;
let mut stdout = std::io::stdout();
graph.to_dot(&mut stdout)?;
/* parse from memory */
let graph = parser::parse_from_memory(/* dot file contents in memory */)?;
let mut stdout = std::io::stdout();
graph.to_dot(&mut stdout)?;
Ok(())
}