-
Notifications
You must be signed in to change notification settings - Fork 284
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
TypedArray::from_slice()
#925
Conversation
I tried adding |
JsArrayBuffer::from_slice()
and JsTypedArray::from_slice()
TypedArray::from_slice()
Update: I've moved the |
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.
It would be nice to have some docs added to JsTypedArray
(and possibly a mirrored JsTypedArray::from_slice
method) to help users find this constructor since it's not typical in Rust for a type's constructor to be on a trait.
Co-authored-by: K.J. Valencik <kjvalencik@gmail.com>
- TypedArray doesn't need to explicit inherit Sealed since Value does - Binary now inherits Copy
…egates to the trait method.
…r` and `JsBuffer`.
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.
Awesome! Love these improvements!
This PR follows on #909 with an additional
TypedArray::from_slice()
method, making it convenient and easy to copy from a Rust slice into a new typed array.This is not only convenient, but also mitigates the ergonomic cost of deprecating
JsArrayBuffer::external()
, which seems like it'll be necessary due to recent changes in V8 to deprecate external typed arrays.