运行以下代码时:
货运.toml
[lib]
crate-type = ["cdylib"]
[dependencies]
serde = { version = "1.0", features = ["derive"] }
wasm-bindgen = {version = "0.2.67", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4.17"
库文件
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[derive(Serialize, Deserialize)]
struct Output {
strings: Vec<String>,
}
#[wasm_bindgen] //error occuring here
pub async fn return_strings(_input: &str) -> JsValue {
//example function that returns a js value
let strings: Vec<String> = Default::default();
let output = Output { strings };
JsValue::from_serde(&output).unwrap()
}
我收到以下错误:
*arg0
活得不够长
借来的价值 活得不够长 论据要求*arg0
借来'static
的