Skip to main content

to_dot

Function to_dot 

Source
pub fn to_dot(graph: &AsyncStepGraph) -> String
Expand description

Render an AsyncStepGraph as a Graphviz DOT string.

ยงExamples

use async_reify::{AsyncStepGraph, StepNode, StepOutcome, to_dot};

let graph = AsyncStepGraph {
    steps: vec![
        StepNode { id: 0, label: "start".into(), duration_us: 100, outcome: StepOutcome::Completed },
        StepNode { id: 1, label: "end".into(), duration_us: 50, outcome: StepOutcome::Completed },
    ],
    edges: vec![(0, 1)],
};
let dot = to_dot(&graph);
assert!(dot.contains("digraph"));
assert!(dot.contains("start"));
assert!(dot.contains("end"));