pub fn run_json(
source: &str,
fuel: Option<u64>,
deadline_ms: Option<u64>,
) -> StringExpand description
Checks, lowers and runs source, and answers what happened.
{"ok":bool,"diagnostics":[...],"ir":string|null,"outcome":string|null,
"stdout":string,"stderr":string,"answer":value|null,
"instructions":int|null,"fuel":int|null}ir is compile_json’s, repeated here so that one call fills every
pane a page shows. A page that asked for the disassembly separately would
be paying for the front end twice for one source, and the two answers
could describe different text if the reader typed between them.
outcome is RunOutcome::as_str, derived the way
crates/cove-cli/tests/differential.rs derives it, so the name a page
shows is the name a trace would have recorded. answer is the entry’s
value in cove_runtime::value_to_json’s encoding, which is this
repository’s existing answer to how a Cove value leaves Rust.
A source that did not compile is answered without being run, with the same
diagnostics compile_json would have given: a page can call this one
function and get both halves.
fuel and deadline_ms are None for “use RUN_LIMITS”, not for “no
bound”. A playground that could be asked for an unbounded run would be a
page with a hang button.