Skip to content
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

[Merged by Bors] - API to construct a NativeFunction from a native async function #2542

Closed
wants to merge 13 commits into from

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Jan 18, 2023

Builds off of #2529. Merged.

This Pull Request allows passing any function returning impl Future<Output = JsResult<JsValue>> to the NativeFunction constructor, allowing native concurrency hooks into the engine.

It changes the following:

  • Adds a NativeFunction::from_async_fn function.
  • Adds a new JobQueue::enqueue_future_job method.
  • Adds an example usage on boa_examples.

@jedel1043 jedel1043 added enhancement New feature or request execution Issues or PRs related to code execution labels Jan 18, 2023
@jedel1043 jedel1043 added this to the v0.17.0 milestone Jan 18, 2023
@github-actions
Copy link

github-actions bot commented Jan 18, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,141 94,141 0
Passed 71,914 71,914 0
Ignored 17,218 17,218 0
Failed 5,009 5,009 0
Panics 12 12 0
Conformance 76.39% 76.39% 0.00%

@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Merging #2542 (a6aa857) into main (591befe) will increase coverage by 0.16%.
The diff coverage is 6.84%.

@@            Coverage Diff             @@
##             main    #2542      +/-   ##
==========================================
+ Coverage   49.55%   49.71%   +0.16%     
==========================================
  Files         386      384       -2     
  Lines       39133    38996     -137     
==========================================
- Hits        19391    19386       -5     
+ Misses      19742    19610     -132     
Impacted Files Coverage Δ
boa_cli/src/main.rs 0.90% <0.00%> (-0.03%) ⬇️
boa_engine/src/job.rs 53.48% <0.00%> (-5.49%) ⬇️
boa_engine/src/native_function.rs 45.09% <0.00%> (-31.57%) ⬇️
boa_examples/src/bin/futures.rs 0.00% <0.00%> (ø)
boa_interner/src/lib.rs 84.03% <ø> (ø)
boa_engine/src/builtins/promise/mod.rs 22.52% <100.00%> (-0.39%) ⬇️
boa_engine/src/value/display.rs 86.56% <0.00%> (-0.75%) ⬇️
boa_engine/src/object/mod.rs 29.13% <0.00%> (-0.11%) ⬇️
boa_examples/src/bin/jstypedarray.rs
boa_examples/src/bin/jsarraybuffer.rs
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jedel1043 jedel1043 force-pushed the native-async branch 2 times, most recently from d7e4b4e to 0c5f9c1 Compare January 20, 2023 06:37
@jedel1043 jedel1043 changed the title Create an API to construct a NativeFunction from a native async function API to construct a NativeFunction from a native async function Jan 22, 2023
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks perfect to me! Great work @jedel1043

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me 😄

@jedel1043
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Feb 24, 2023
~~Builds off of #2529.~~ Merged.

This Pull Request allows passing any function returning `impl Future<Output = JsResult<JsValue>>` to the `NativeFunction` constructor, allowing native concurrency hooks into the engine.

It changes the following:

- Adds a `NativeFunction::from_async_fn` function.
- Adds a new `JobQueue::enqueue_future_job` method.
- Adds an example usage on `boa_examples`.
@bors
Copy link

bors bot commented Feb 24, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title API to construct a NativeFunction from a native async function [Merged by Bors] - API to construct a NativeFunction from a native async function Feb 24, 2023
@bors bors bot closed this Feb 24, 2023
@bors bors bot deleted the native-async branch February 24, 2023 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants