-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Implement PackedArray::as_slice #306
Comments
Fun fact: this was already implemented in #137, but the author closed the pull request and did not respond anymore 🤷 I can rewrite the code later, would anyway do a few things a bit differently. |
bors bot
added a commit
that referenced
this issue
Jun 12, 2023
307: Implement `PackedArray::as_slice()`, `as_slice_mut()` r=Bromeon a=Bromeon Resumes abandoned work of #137. Closes #306. Open points: 1. Test CoW across GDScript/Rust boundaries? 2. We now have `slice`, `as_slice` and `as_mut_slice`, where the first returns another array. I wonder if it would be clearer to name it `sub_array` or something instead of `slice`? bors try Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot
added a commit
that referenced
this issue
Jun 12, 2023
307: Implement `PackedArray::as_slice()`, `as_slice_mut()` r=Bromeon a=Bromeon Resumes abandoned work of #137. Closes #306. Open points: 1. Test CoW across GDScript/Rust boundaries? 2. We now have `slice`, `as_slice` and `as_mut_slice`, where the first returns another array. I wonder if it would be clearer to name it `sub_array` or something instead of `slice`? bors try Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot
added a commit
that referenced
this issue
Jun 12, 2023
307: Implement `PackedArray::as_slice()`, `as_slice_mut()` r=Bromeon a=Bromeon Resumes abandoned work of #137. Closes #306. Open points: 1. Test CoW across GDScript/Rust boundaries? 2. We now have `slice`, `as_slice` and `as_mut_slice`, where the first returns another array. I wonder if it would be clearer to name it `sub_array` or something instead of `slice`? bors try Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot
added a commit
that referenced
this issue
Jun 12, 2023
307: Implement `PackedArray::as_slice()`, `as_slice_mut()` r=Bromeon a=Bromeon Resumes abandoned work of #137. Closes #306. Open points: 1. Test CoW across GDScript/Rust boundaries? 2. We now have `slice`, `as_slice` and `as_mut_slice`, where the first returns another array. I wonder if it would be clearer to name it `sub_array` or something instead of `slice`? bors try Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot
added a commit
that referenced
this issue
Jun 12, 2023
307: Implement `PackedArray::as_slice()`, `as_slice_mut()` r=Bromeon a=Bromeon Resumes abandoned work of #137. Closes #306. Open points: 1. Test CoW across GDScript/Rust boundaries? 2. We now have `slice`, `as_slice` and `as_mut_slice`, where the first returns another array. I wonder if it would be clearer to name it `sub_array` or something instead of `slice`? bors try Co-authored-by: Jan Haller <bromeon@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If PackedArrays are stored contiguously in memory, it should be possible to return a slice instead of copying all data to the vec. It seams like a guite significant overhead especially when working with
Image
.Unfortunately, currently it is impossible to implement as an extension trait because
PackedArray::ptr
andPackedArray::ptr_mut
are private.Proposed implementation is quite simple:
The text was updated successfully, but these errors were encountered: