lex-trace 0.11.0

Run-time trace tree + replay for Lex programs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Replay: re-execute a function with effect-output overrides keyed by NodeId.

use indexmap::IndexMap;

#[derive(Debug, Clone)]
pub struct Override {
    pub node_id: String,
    pub output: serde_json::Value,
}

/// Convert a list of overrides into the IndexMap shape the recorder uses.
pub fn replay_with_overrides(overrides: &[Override]) -> IndexMap<String, serde_json::Value> {
    let mut m = IndexMap::new();
    for o in overrides {
        m.insert(o.node_id.clone(), o.output.clone());
    }
    m
}