-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplifying Function Binding #3799
Comments
There are some differences, I need to add the rust function to js in a way similar to rquickjs. fn add(a: i32, b: i32) -> i32 {
a + b
}
global
.set(
"add",
Function::new(ctx.clone(), add )
.unwrap()
.with_name("add")
.unwrap(),
) I wanted a way to add rust functions directly using register_global_property fn add(a: i32, b: i32) -> i32 {
a + b
}
context
.register_global_property(js_string!( "add" ),
add,
Attribute::all())
.unwrap(); In mpv-boa, I've implemented a similar macros , but it's not perfect and still requires the use of macros to generate a boa-style function |
With my PR that example should work almost right out. I think the only thing might be missing a |
Oh the PR is not in yet; #3773 |
Is it possible to use macros to convert normal rust functions to boa form, normal rust functions are more general and easier to test
The text was updated successfully, but these errors were encountered: