Open dherman opened 1 month ago
This PR implements JsFunction::bind(), which creates a builder for calling a function using the Try{From,Into}Js traits.
JsFunction::bind()
Try{From,Into}Js
let n = f.bind(&mut cx) .args((1, 2, 3))? .arg(4)? .arg_with(|cx| Ok(cx.number(5)))? .apply::<f64>()?;
It also implements Object::prop(), which creates a builder for accessing object properties using the Try{From,Into}Js traits.
Object::prop()
let x: f64 = obj .prop(&mut cx, "x") .get()?; obj.prop(&mut cx, "y") .set(x)?; let s: String = obj.prop(&mut cx, "toString") .bind()? .apply()?;
This PR implements
JsFunction::bind()
, which creates a builder for calling a function using theTry{From,Into}Js
traits.It also implements
Object::prop()
, which creates a builder for accessing object properties using theTry{From,Into}Js
traits.