mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-15 04:23:12 +03:00
7b495468f6
This commit implements support for binding APIs that take `Uint8ClampedArray` in JS. This is pretty rare but comes up in a `web-sys` binding or two, and we're now able to bind these APIs instead of having to omit the bindings. The `Uint8ClampedArray` type is bound by using the `Clamped` marker struct in Rust. For example this is declaring a JS API that takes `Uint8ClampedArray`: use wasm_bindgen::Clamped; #[wasm_bindgen] extern { fn takes_clamped(a: Clamped<&[u8]>); } The `Clamped` type currently only works when wrapping the `&[u8]`, `&mut [u8]`, and `Vec<u8>` types. Everything else will produce an error at `wasm-bindgen` time. Closes #421
18 lines
297 B
TOML
18 lines
297 B
TOML
[package]
|
|
name = "julia_set"
|
|
version = "0.1.0"
|
|
authors = ["Marcin Baraniecki <marcinbar1@gmail.com>"]
|
|
|
|
[lib]
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
wasm-bindgen = { path = "../.." }
|
|
|
|
[dependencies.web-sys]
|
|
path = '../../crates/web-sys'
|
|
features = [
|
|
'ImageData',
|
|
'CanvasRenderingContext2d',
|
|
]
|