Sha256: 5a0068fe3e214c07da92a46b6e45a2771fbd8e04f14cb7802f32082b87a459a0

Contents?: true

Size: 1.34 KB

Versions: 30

Compression:

Stored size: 1.34 KB

Contents

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

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

/// annotated function ✔️ " \ ' {
#[wasm_bindgen]
pub fn annotated() -> String {
    String::new()
}

/// annotated struct type
#[wasm_bindgen]
pub struct Annotated {
    a: String,
    /// annotated struct field b
    pub b: u32,
    /// annotated struct field c
    #[wasm_bindgen(readonly)]
    pub c: u32,
    d: u32,
}

#[wasm_bindgen]
impl Annotated {
    /// annotated struct constructor
    #[wasm_bindgen(constructor)]
    pub fn new() -> Self {
        Self {
            a: String::new(),
            b: 0,
            c: 0,
            d: 0,
        }
    }

    /// annotated struct method
    pub fn get_a(&self) -> String {
        self.a.clone()
    }

    /// annotated struct getter
    #[wasm_bindgen(getter)]
    pub fn d(&self) -> u32 {
        self.d
    }

    /// annotated struct setter
    #[wasm_bindgen(setter)]
    pub fn set_d(&mut self, value: u32) {
        self.d = value
    }

    /// annotated struct static method
    pub fn static_method() {}
}

/// annotated enum type
#[wasm_bindgen]
pub enum AnnotatedEnum {
    /// annotated enum variant 1
    Variant1,
    /// annotated enum variant 2
    Variant2,
}

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

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/comments.rs
wasmtime-22.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-21.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-20.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-20.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-18.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-17.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-17.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-16.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-15.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-15.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/comments.rs
wasmtime-14.0.4 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-14.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-14.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-14.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-13.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-12.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-12.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-11.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs
wasmtime-10.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/comments.rs