-
-
Notifications
You must be signed in to change notification settings - Fork 411
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] - Implement TryFromJs
for JsObject
wrappers
#2809
Conversation
Test262 conformance changes
|
Codecov Report
@@ Coverage Diff @@
## main #2809 +/- ##
==========================================
- Coverage 51.31% 51.07% -0.25%
==========================================
Files 416 416
Lines 41213 41407 +194
==========================================
- Hits 21149 21148 -1
- Misses 20064 20259 +195
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Wouldn't
I think this can be done by getting the It's not that intuitive, we should probably have helper methods
We have from |
Indeed, it was just not available at the
I have added them :)
No need to create an issue, I have added it to this PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect to me! :)
Co-authored-by: raskad <[email protected]>
bors r+ |
This change allows using built-in `JsObject` wrappers with the `TryFromJs` logic, which makes it easier to derive it in complex objects containing known built-ins, being able to use all the power of the wrappers even inside complex structures. It changes the following: * Implements `TryFromJs` for all `JsObject` wrappers ~, except for `JsProxy` and `Js<Int>Array` wrappers~ -> This has now been added. * Adds checker functions for individual typed array objects. * Adds some missing checker functions from `Object` to `JsObject` ~The reason for not implementing it for `JsProxy` is that we don't have a way (as far as I can tell) to know if a `JsObject` is a `Proxy` object. The reason for the typed arrays (note that `JsTypedArray` implements `TryFromJs`) is that I didn't find an easy way to know which type of typed array a `JsObject` was. Do we have a way of using a `JsObject` to create a Rust `JsUint8Array` or the like?~
Pull request successfully merged into main. Build succeeded: |
TryFromJs
for JsObject
wrappersTryFromJs
for JsObject
wrappers
This change allows using built-in
JsObject
wrappers with theTryFromJs
logic, which makes it easier to derive it in complex objects containing known built-ins, being able to use all the power of the wrappers even inside complex structures.It changes the following:
TryFromJs
for allJsObject
wrappers, except for-> This has now been added.JsProxy
andJs<Int>Array
wrappersObject
toJsObject
The reason for not implementing it forJsProxy
is that we don't have a way (as far as I can tell) to know if aJsObject
is aProxy
object. The reason for the typed arrays (note thatJsTypedArray
implementsTryFromJs
) is that I didn't find an easy way to know which type of typed array aJsObject
was. Do we have a way of using aJsObject
to create a RustJsUint8Array
or the like?