Skip to content

Ability to return a Vec<String> #168

@mstange

Description

@mstange

Annotating a function which returns a Vec<String> with #[wasm_bindgen] gives the following error:

error[E0277]: the trait bound `std::boxed::Box<[std::string::String]>: wasm_bindgen::convert::IntoWasmAbi` is not satisfied
  --> src/lib.rs:12:1
   |
12 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ the trait `wasm_bindgen::convert::IntoWasmAbi` is not implemented for `std::boxed::Box<[std::string::String]>`
   |
   = help: the following implementations were found:
             <std::boxed::Box<[f64]> as wasm_bindgen::convert::IntoWasmAbi>
             <std::boxed::Box<[u32]> as wasm_bindgen::convert::IntoWasmAbi>
             <std::boxed::Box<[i16]> as wasm_bindgen::convert::IntoWasmAbi>
             <std::boxed::Box<[u16]> as wasm_bindgen::convert::IntoWasmAbi>
           and 5 others
   = note: required because of the requirements on the impl of `wasm_bindgen::convert::IntoWasmAbi` for `std::vec::Vec<std::string::String>`

Metadata

Metadata

Assignees

No one assigned

    Labels

    more-typesAdding support for more Rust types to cross the boundary

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions