返回 Option<Box<[Box<[JsValue]>]>> 从 Rust fn 到 Wasm 的替代方法



我正在尝试返回 std::boxed::Box<[std::boxed::Box<[wasm_bindgen::JsValue]>]>在我的生锈代码到WASM中,但会遇到此错误。

我了解特征没有实现,但是是否有解决方法?

原始错误

#[wasm_bindgen]

|^^^^^^^^^^^^^^^^特征wasm_bindgen::convert::traits::OptionIntoWasmAbi未针对std::boxed::Box<[std::boxed::Box<[wasm_bindgen::JsValue]>]>

实现

对于那些正在寻找答案的人,我设法返回Option<js_sys::Array>来解决此问题。我知道这并不完全相同,但它对我有用。

最新更新