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

Add more utility traits and funtions to boa_interop #3773

Merged
merged 14 commits into from
Apr 9, 2024

Conversation

hansl
Copy link
Contributor

@hansl hansl commented Mar 29, 2024

This PR adds support for Fn(...) closures, assuming the closure is Copy. This should satisfy the unsafe requirement established in #3772 for that kind of function.

This also add implementations for both IntoJsFunction and IntoJsFunctionUnsafe for up to 12 arguments, including a JsRest argument, a JsThis argument and a Context argument, all of whom can be placed at the end of the list of required arguments.

This also adds support for return value from the functions, both JsValue-convertible types as well as JsResult<...>, as long as the inner value is convertible to a JsValue.

@hansl hansl mentioned this pull request Mar 29, 2024
@hansl hansl marked this pull request as draft March 29, 2024 05:48
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 29.54545% with 62 lines in your changes are missing coverage. Please review.

Project coverage is 50.30%. Comparing base (6ddc2b4) to head (deda29b).
Report is 126 commits behind head on main.

Files Patch % Lines
core/interop/src/lib.rs 23.07% 30 Missing ⚠️
core/interop/src/into_js_function_impls.rs 31.70% 28 Missing ⚠️
core/engine/src/try_into_js_result_impls.rs 50.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3773      +/-   ##
==========================================
+ Coverage   47.24%   50.30%   +3.05%     
==========================================
  Files         476      458      -18     
  Lines       46892    44905    -1987     
==========================================
+ Hits        22154    22589     +435     
+ Misses      24738    22316    -2422     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hansl hansl changed the title Boa interop 2 Add more utility traits and funtions to boa_interop Apr 4, 2024
@hansl hansl marked this pull request as ready for review April 4, 2024 04:33
core/interop/src/lib.rs Outdated Show resolved Hide resolved
@hansl hansl requested a review from jedel1043 April 6, 2024 20:13
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Just have two small suggestions. Everything else looks great!

core/interop/src/lib.rs Show resolved Hide resolved
core/interop/src/lib.rs Show resolved Hide resolved
@hansl hansl requested a review from jedel1043 April 7, 2024 00:03
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Really nice API! I'm preemptively approving considering that we'll work on this incrementally, but left some additional comments for discussion.

core/interop/src/try_into_js_result_impls.rs Outdated Show resolved Hide resolved
core/interop/src/lib.rs Show resolved Hide resolved
@jedel1043 jedel1043 requested a review from a team April 8, 2024 04:14
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 is looking great! I had one small question.

core/interop/src/lib.rs Show resolved Hide resolved
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.

LGTM :)

@nekevss nekevss added this pull request to the merge queue Apr 9, 2024
Merged via the queue into boa-dev:main with commit 9702501 Apr 9, 2024
14 checks passed
@hansl hansl deleted the boa_interop_2 branch April 9, 2024 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants