-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Adding TryFromJs implementations for tuples #3843
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3843 +/- ##
==========================================
+ Coverage 47.24% 50.79% +3.54%
==========================================
Files 476 468 -8
Lines 46892 45281 -1611
==========================================
+ Hits 22154 22999 +845
+ Misses 24738 22282 -2456 ☔ View full report in Codecov by Sentry. |
No idea why the Windows action is failing. |
If you rebase the CI should be fixed 😄 There was an issue that was fixed with #3845. |
//! - If the tuple is longer than the array, the extra elements are `undefined`. | ||
//! - If the array is empty, all elements are `undefined`. | ||
//! | ||
//! A tuple of size 0 (unit type) is represented as any value except `null` or `undefined`. |
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.
I'm a bit conflicted about this.
On the one hand, I think it makes sense to use any non-nullable value as the unit type, because undefined
in JS is commonly used to represent the absence of a value, which ()
doesn't represent on the Rust world.
On the other hand, it would be a lot less surprising for new users to have it be undefined
, since that's the default value for functions that don't return, which would be equivalent to how Rust functions return ()
when the function doesn't explicitly return.
I think I'm tending towards the second option, but I would be happy to know your thoughts on this.
This make it easier to get the first N values from an array when de-serializing.