Skip to content

Conversation

lshlyapnikov
Copy link
Contributor

@lshlyapnikov lshlyapnikov commented Nov 4, 2019

See #1643

TODO:

  • add Uint8Array::view_mut_raw test
  • add Int16Array::view_mut_raw test
  • add Uint32Array::view_mut_raw test
  • add Float64Array::view_mut_raw test

@alexcrichton
Copy link
Contributor

Looking good!

I'd be happy to merge when you're ready!

@lshlyapnikov lshlyapnikov marked this pull request as ready for review November 6, 2019 02:10
///
/// Additionally the returned object can be safely mutated,
/// the changes are guranteed to be reflected in the input array.
pub unsafe fn view_mut_raw(ptr: *mut $ty, length: usize) -> $name {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexcrichton please doublecheck the rustdoc.

@alexcrichton
Copy link
Contributor

Looks great to me, thanks!

@alexcrichton alexcrichton merged commit d51f539 into wasm-bindgen:master Nov 6, 2019
@mstange
Copy link
Contributor

mstange commented Nov 7, 2019

Thank you!

josephlr added a commit to rust-random/getrandom that referenced this pull request Oct 23, 2022
We can use
[`Uint8Array::view_mut_raw`](https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Uint8Array.html#method.view_mut_raw)
which was
[added](wasm-bindgen/wasm-bindgen#1850) in version
`0.2.54` of `wasm-bindgen`. This method was introduced to deal with
uninitialized memory, see the Safety comment for more info.

Signed-off-by: Joe Richey <[email protected]>
josephlr added a commit to rust-random/getrandom that referenced this pull request Oct 23, 2022
We can use
[`Uint8Array::view_mut_raw`](https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Uint8Array.html#method.view_mut_raw)
which was
[added](wasm-bindgen/wasm-bindgen#1850) in version
`0.2.54` of `wasm-bindgen`. This method was introduced to deal with
uninitialized memory, see the Safety comment for more info.

Signed-off-by: Joe Richey <[email protected]>
josephlr added a commit to rust-random/getrandom that referenced this pull request Oct 23, 2022
We can use
[`Uint8Array::view_mut_raw`](https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Uint8Array.html#method.view_mut_raw)
which was
[added](wasm-bindgen/wasm-bindgen#1850) in version
`0.2.54` of `wasm-bindgen`. This method was introduced to deal with
uninitialized memory, see the Safety comment for more info.

Signed-off-by: Joe Richey <[email protected]>
josephlr added a commit to rust-random/getrandom that referenced this pull request Oct 23, 2022
We can use
[`Uint8Array::view_mut_raw`](https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Uint8Array.html#method.view_mut_raw)
which was
[added](wasm-bindgen/wasm-bindgen#1850) in version
`0.2.54` of `wasm-bindgen`. This method was introduced to deal with
uninitialized memory, see the Safety comment for more info.

Signed-off-by: Joe Richey <[email protected]>
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.

3 participants