Function quickjs_wasm_rs::to_qjs_value
source · pub fn to_qjs_value<'a>(
context: &'a JSContextRef,
val: &JSValue
) -> Result<JSValueRef<'a>>Expand description
Converts a reference to a JSValue to a quickjs_wasm_rs::JSValueRef.
§Arguments
context- a reference to aquickjs_wasm_rs::JSContextRef. TheJSValueRefis created for this JS context.val- a reference to aJSValueto be converted to aJSValueRef
§Returns
anyhow::Result<JSValueRef>
§Example
let context = JSContextRef::default();
let js_val = "hello".into();
let qjs_val = to_qjs_value(&context, &js_val).unwrap();