2018-08-07 17:53:30 +03:00
|
|
|
#![cfg(target_arch = "wasm32")]
|
|
|
|
|
|
|
|
extern crate wasm_bindgen;
|
2018-09-26 18:26:00 +03:00
|
|
|
extern crate wasm_bindgen_test;
|
2018-08-07 17:53:30 +03:00
|
|
|
|
|
|
|
use wasm_bindgen::prelude::*;
|
2018-09-26 18:26:00 +03:00
|
|
|
use wasm_bindgen_test::*;
|
2018-08-07 17:53:30 +03:00
|
|
|
|
|
|
|
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.
|
2018-09-26 18:26:00 +03:00
|
|
|
pub fn consume(self) -> String {
|
|
|
|
String::new()
|
|
|
|
}
|
2018-08-07 17:53:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen_test]
|
|
|
|
fn works() {
|
|
|
|
ConsumeRetString.consume();
|
|
|
|
}
|