MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / record

Function record

libatomic/examples/replication_acceptance/main.rs:52–60  ·  view source on GitHub ↗
(report: &mut Value, name: &str, value: Value)

Source from the content-addressed store, hash-verified

50 Ok(())
51}
52fn record(report: &mut Value, name: &str, value: Value) {
53 report.as_object_mut().unwrap().insert(name.into(), value);
54 if let Some(root) = report["root"].as_str() {
55 // Preserve completed observations if a later stage fails.
56 let _ = serde_json::to_vec_pretty(report).and_then(|bytes| {
57 fs::write(Path::new(root).join("report.json"), bytes).map_err(serde_json::Error::io)
58 });
59 }
60}
61fn run(binary: &Path, root: &Path) -> Result<Value> {
62 let config = root.join("isolated-config");
63 fs::create_dir_all(&config)?;

Callers 1

runFunction · 0.70

Calls 4

writeFunction · 0.70
insertMethod · 0.45
unwrapMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected