-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning Vec<T> where T: IntoWasmAbi #49
Comments
The problem seems to be that tsify needs to implement the |
The tsify-next crate added support for that recently. It might be reasonable to switch to that crate as this one seems unmaintained. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! Thanks for a great library!
In rustwasm/wasm-bindgen#3554 (See also: rustwasm/wasm-bindgen#111 ) the possibility to return a
Vec<SomeType>
whereSomeType
has#[wasm_bindgen]
on it was introduced.Later, in rustwasm/wasm-bindgen#3692 @hillin asked why it wasn't possible to return a
Vec<T>
whereT: IntoWasmAbi
. I now have the exact same question. Unfortunately that issue was closed, and moved into this discussion rustwasm/wasm-bindgen#3697 where it received only one reply, from the question asker themself.The answer was to create a newtype that itself is
IntoWasmAbi
and then return that:Which works, but now I have to have a number of newtypes that I don't want in my code.
I tried improving the situation by creating a generic version of that:
Which kind of half-worked - the TS type was correctly generated, but the return value of the function lacked the generic type argument:
So the question is, what's the solution here?
wasm-bindgen
to implement support forVec<T: IntoWasmAbi>
?tsify
to put the correct generic argument on the ts return type (i.e.getThings(): GenericCollection<Thing>;
)?The text was updated successfully, but these errors were encountered: