Skip to main content

cove_run

Function cove_run 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn cove_run( source: *const u8, len: usize, fuel: u32, deadline_ms: u32, ) -> *mut u8
Expand description

Checks, lowers and runs source, and answers what it printed, what it produced and how it ended. See crate::run_json.

fuel and deadline_ms are the two bounds a page can put on a run; zero means “whatever crate::RUN_LIMITS says”, which is a bound and not the absence of one. A deadline is enforced against the imported clock, so it does what it says.

They are u32 and not u64 although cove_runtime::Limits counts fuel in u64, because a u64 parameter is a wasm i64, and a wasm i64 reaches JavaScript as a BigInt: every caller would have to write 10n where it means ten. Four billion units of fuel is far past what a tab should spend before a page decides it has hung, and forty-nine days is past what a deadline in a browser can mean, so nothing is lost that the awkwardness would buy back.

§Safety

As cove_compile.