rustviz-lib 2.0.0

Library API for generating RustViz ownership/borrow visualizations by shelling out to the rustviz-plugin rustc plugin.
docs.rs failed to build rustviz-lib-2.0.0
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.

rustviz-lib

The Rust API for RustViz. Renders a single Rust source file through the RustViz rustc plugin and returns the resulting code-panel + timeline-panel SVGs.

use rustviz_lib::Rustviz;

let code = r#"
fn main() {
    let s = String::from("hello");
    let t = s;
    println!("{}", t);
}
"#;

let rv = Rustviz::new(code).expect("plugin invocation failed");
std::fs::write("code.svg", rv.code_panel_string())?;
std::fs::write("timeline.svg", rv.timeline_panel_string())?;

The plugin runs out-of-process. By default the lib shells out to cargo rv-plugin against a generated tempdir crate (the local backend), which means it needs the matching nightly toolchain + the plugin installed:

cargo install rustviz-cli   # bundles the bootstrap helper
rustviz init                # rustup install + cargo install rustviz-plugin

For a sandboxed backend appropriate for untrusted input (e.g. a public web playground), set RV_RUNNER=docker and ensure the rustviz/rustviz-runner image is on the host. See playground/SECURITY.md for the full sandboxing contract.

If you just want a CLI rather than a programmatic API, install rustviz-cli and use rustviz svg / rustviz html.