graphviz-anywhere 0.1.1

Safe Rust wrapper for the graphviz-anywhere C library with bundled prebuilt binaries
docs.rs failed to build graphviz-anywhere-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

Safe Rust wrapper for the graphviz-anywhere C library.

This crate provides a memory-safe, idiomatic Rust interface to Graphviz layout and rendering. It wraps the low-level C ABI exposed by libgraphviz_api.

Example

use graphviz_anywhere::{GraphvizContext, Engine, Format};

let ctx = GraphvizContext::new().expect("failed to create context");
let dot = r#"digraph G { a -> b; }"#;
let svg = ctx.render(dot, Engine::Dot, Format::Svg).unwrap();
println!("{}", String::from_utf8_lossy(&svg));

Thread Safety

[GraphvizContext] is deliberately !Send and !Sync because the underlying Graphviz library uses global mutable state and is not thread-safe. Each thread that needs rendering should create its own context, or access should be externally synchronized.