pub fn reify_execution(events: Vec<PollEvent>) -> AsyncStepGraphExpand description
Extract an AsyncStepGraph from a sequence of PollEvents.
Groups consecutive events by label to form steps, and connects
them with sequential edges. The outcome of each step is the outcome
of the last event in its group: Ready โ Completed, Pending โ
Pending, Cancelled โ Cancelled.
ยงExamples
use async_reify::{PollEvent, PollResult, StepOutcome};
use async_reify::reify_execution;
use std::time::Duration;
let events = vec![
PollEvent { step: 0, offset: Duration::ZERO, result: PollResult::Pending, label: Some("a".into()) },
PollEvent { step: 1, offset: Duration::from_micros(50), result: PollResult::Ready, label: Some("a".into()) },
PollEvent { step: 2, offset: Duration::from_micros(75), result: PollResult::Ready, label: Some("b".into()) },
];
let graph = reify_execution(events);
assert_eq!(graph.steps.len(), 2); // "a" and "b"
assert_eq!(graph.edges.len(), 1); // a -> b