wasm-bindgen/tests/all
Alex Crichton 0566a97485 Add support for mutable slices
This commit adds support for mutable slices to pass the boundary between JS and
Rust. While mutable slices cannot be used as return values they can be listed as
arguments to both exported functions as well as imported functions.

When passing a mutable slice into a Rust function (aka having it as an argument
to an exported Rust function) then like before with a normal slice it's copied
into the wasm memory. Afterwards, however, the updates in the wasm memory will
be reflected back into the original slice. This does require a lot of copying
and probably isn't the most efficient, but it should at least work for the time
being.

The real nifty part happens when Rust passes a mutable slice out to JS. When
doing this it's a very cheap operation that just gets a subarray of the main
wasm memory. Now the wasm memory's buffer can change over time which can produce
surprising results where memory is modified in JS but it may not be reflected
back into Rust. To accomodate this when a JS imported function returns any
updates to the buffer are copied back to Rust if Rust's memory buffer has
changed in the meantime.

Along the way this fixes usage of `slice` to instead use `subarray` as that's
what we really want, no copying. All methods have been updated to use `subarray`
accessors instead of `slice` or constructing new arrays.

Closes #53
2018-05-01 10:06:35 -07:00
..
api.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00
classes.rs Implement readonly struct fields 2018-04-20 10:56:10 -07:00
closures.rs Fix unused variables in generated code 2018-04-19 13:16:59 -07:00
dependencies.rs No need to expose ptr in TypeScript 2018-04-19 13:28:50 -07:00
enums.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00
import_class.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00
imports.rs Add support for version specifications 2018-04-25 22:23:02 -07:00
jsobjects.rs Add JsValue::{from_serde, into_serde} 2018-04-26 20:45:22 -07:00
main.rs Enable cargo test where possible 2018-04-27 15:01:35 -07:00
math.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00
node.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00
non_debug.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00
non_wasm.rs Enable cargo test where possible 2018-04-27 15:01:35 -07:00
simple.rs Assert empty JS heap/stack in tests 2018-04-25 22:15:28 -07:00
slice.rs Add support for mutable slices 2018-05-01 10:06:35 -07:00
structural.rs Move all tests to the same suite 2018-04-09 15:32:06 -07:00