Stream: git-wasmtime

Topic: wasmtime / Issue #463 Make `Vec<T>` a wasmtime interface ...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 13 2020 at 19:57):

alexcrichton commented on Issue #463:

I'm going to now that we've temporarily removed interface types support, but stay tuned to https://github.com/bytecodealliance/wasmtime/issues/677 for future updates!

view this post on Zulip Wasmtime GitHub notifications bot (Mar 13 2020 at 19:57):

alexcrichton closed Issue #463:

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.


Last updated: Dec 23 2024 at 13:07 UTC