Skip to main content

result_value

Function result_value 

Source
pub fn result_value(context: &JsContext, result: JsResult<Value>) -> JsValue
Expand description

Turn an engine result into the JSValue a C caller expects.

The one rule the whole API follows: an owned value becomes a boxed JSValue, and a failure becomes jsvalue::EXCEPTION with the reason stored as the context’s pending exception. JS_ToInt32(ctx, …, v) then answers -1, the C function returns JS_EXCEPTION, and the trampoline that invoked it turns the pending exception into the engine’s Signal::Throw.