mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-11 11:15:33 +03:00
d4297ad2d3
This has now been stabilized!
27 lines
586 B
Rust
27 lines
586 B
Rust
#![cfg(target_arch = "wasm32")]
|
|
|
|
extern crate wasm_bindgen_test;
|
|
extern crate wasm_bindgen;
|
|
|
|
use wasm_bindgen_test::*;
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
wasm_bindgen_test_configure!(run_in_browser);
|
|
|
|
#[wasm_bindgen]
|
|
pub struct ConsumeRetString;
|
|
|
|
#[wasm_bindgen]
|
|
impl ConsumeRetString {
|
|
// https://github.com/rustwasm/wasm-bindgen/issues/329#issuecomment-411082013
|
|
//
|
|
// This used to cause two `const ptr = ...` declarations, which is invalid
|
|
// JS.
|
|
pub fn consume(self) -> String { String::new() }
|
|
}
|
|
|
|
#[wasm_bindgen_test]
|
|
fn works() {
|
|
ConsumeRetString.consume();
|
|
}
|