Skip to content
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

Make Vec<T> a wasmtime interface type #463

Closed
Limeth opened this issue Oct 28, 2019 · 1 comment
Closed

Make Vec<T> a wasmtime interface type #463

Limeth opened this issue Oct 28, 2019 · 1 comment

Comments

@Limeth
Copy link

Limeth commented Oct 28, 2019

As far as I can tell, there currently is no straightforward way to transfer Vec<T> types from a wasm module to the host. It would be desirable to let exported functions return other structured types, than those already supported, like so:

#[wasmtime_rust::wasmtime]
pub trait Module {
    fn test1(&mut self) -> Vec<f32>;
    fn test2(&mut self) -> [f32; 3];
    fn test3(&mut self) -> CustomType;
}

#[wasm_bindgen]
struct CustomType([f32; 3]);

The minimal implementation would add Vec<T> where T: wasmtime_interface_types::Value as a supported type. This would allow CustomType and other types to be serialized to Vec<u8> and passed through the ABI.

@alexcrichton
Copy link
Member

I'm going to now that we've temporarily removed interface types support, but stay tuned to #677 for future updates!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants