trace to string

This commit is contained in:
elvis
2025-10-25 17:46:42 +02:00
parent 969c24bd70
commit fc57e72e80
2 changed files with 41 additions and 2 deletions

View File

@ -1589,7 +1589,33 @@ fn process_template(
} else {
anyhow::bail!("Not a positive system");
}
}
},
| NodeInstruction::TraceToString => {
let trace = retrieve_from_cache![1];
let hash_inputs = hash_inputs!(trace);
if let BasicValue::Trace { value } = trace {
let res = BasicValue::String {
value: format!("{}", Formatter::from(translator, &value)),
};
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
} else {
anyhow::bail!("Not a trace");
}
},
| NodeInstruction::PositiveTraceToString => {
let trace = retrieve_from_cache![1];
let hash_inputs = hash_inputs!(trace);
if let BasicValue::PositiveTrace { value } = trace {
let res = BasicValue::String {
value: format!("{}", Formatter::from(translator, &value)),
};
set_cache_output!((output_names.first().unwrap(), res, hash_inputs));
} else {
anyhow::bail!("Not a positive trace");
}
},
}
Ok(None)
}