Skip to content

Instantly share code, notes, and snippets.

@dherman
Created July 23, 2022 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dherman/5aa20b55400c78966a1042e8f1f69fdf to your computer and use it in GitHub Desktop.
Save dherman/5aa20b55400c78966a1042e8f1f69fdf to your computer and use it in GitHub Desktop.
/*
* https://users.rust-lang.org/t/how-to-implement-index-range-usize-for-a-custom-slice-type-with-additional-data/66201
*
* buffer.region(4, 16).into::<JsUint32Array>
* buffer.from(4).to(16).into::<JsUint32Array>
* buffer[4..16].to_typed_array::<u32, _>(&mut cx)
* JsUint32Array::from_region(&mut cx, buffer[4..16])
* buffer.region(4..16).to_typed_array::<u32, _>(&mut cx)
* JsUint32Array::from_region(&mut cx, buffer.region(4..16))
* JsUint32Array::from_buffer_region(&mut cx, buffer, 4, 16))
*
* buffer.region::<u32>(4, 2).to_typed_array(&mut cx)
* JsUint32Array::from_region(&mut cx, buffer.region(4, 2))
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment