Sha256: dda0e9cea09b94dd84ae39d6cf0949aa305062b7a466fdcb53370f5ee9e3dff5

Contents?: true

Size: 655 Bytes

Versions: 30

Compression:

Stored size: 655 Bytes

Contents

use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;

#[wasm_bindgen(module = "tests/wasm/structural.js")]
extern "C" {
    fn js_works();
}

#[wasm_bindgen]
extern "C" {
    pub type StructuralFoo;

    #[wasm_bindgen(method, structural)]
    fn bar(this: &StructuralFoo);
    #[wasm_bindgen(method, getter, structural)]
    fn baz(this: &StructuralFoo) -> u32;
    #[wasm_bindgen(method, setter, structural)]
    fn set_baz(this: &StructuralFoo, val: u32);
}

#[wasm_bindgen]
pub fn run(a: &StructuralFoo) {
    a.bar();
    assert_eq!(a.baz(), 1);
    a.set_baz(2);
    assert_eq!(a.baz(), 2);
}

#[wasm_bindgen_test]
fn works() {
    js_works();
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-22.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-21.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-20.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-20.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-18.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-17.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-17.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-16.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-15.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-15.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/structural.rs
wasmtime-14.0.4 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-14.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-14.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-14.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-13.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-12.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-12.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-11.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs
wasmtime-10.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/structural.rs