-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements `JsFunction::bind()`, which creates a builder for calling a function using the `Try{From,Into}Js` traits. ```rust let n = f.bind(&mut cx) .args((1, 2, 3))? .arg(4)? .arg_with(|cx| Ok(cx.number(5)))? .call::<f64>()?; ``` Also implements `Object::prop()`, which creates a builder for accessing object properties using the `Try{From,Into}Js` traits. ```rust 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()? .call()?; ``` Finally, it offers a shorthand convenience method `Object::method()`, which extracts an object property and binds it as a method: ```rust let s: String = obj.method(&mut cx, "toString").call()?; ``` --------- Co-authored-by: K.J. Valencik <[email protected]>
- Loading branch information
1 parent
f3568f1
commit 167c7fb
Showing
21 changed files
with
891 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.