Stream: rust-toolchain

Topic: hello world with interface types?


view this post on Zulip Carl Sverre (Aug 26 2021 at 20:49):

I am trying to play with interface types and it seems that wasmtime no longer has them enabled? Still trying to grok the ecosystem... Goal is getting something like this compiling so I can play around with types:

#[wasm_bindgen]
pub fn greet(name: &str) -> String {
    format!("hello {}", name)
}

view this post on Zulip Carl Sverre (Aug 26 2021 at 20:50):

And if wasmtime isn't the best way to go for playing with interface-types... what is?

view this post on Zulip Carl Sverre (Aug 26 2021 at 20:50):

also I should probably cross post this to wasmtime but not 100% sure how to do that in zulip

view this post on Zulip Carl Sverre (Aug 26 2021 at 20:53):

cross posted to #wasmtime > hello world for interface types

view this post on Zulip Peter Huene (Aug 27 2021 at 01:11):

Hi @Carl Sverre. You may want to look at witx-bindgen which has tooling around where we hope interface types is going. With witx-bindgen you can create import and export bindings from a "witx" file that stores a description of an interface. You can also generate bindings for Wasmtime to import an interface to an instance or to call an interface exported by an instance.

A language binding generator for `witx` (a precursor to WebAssembly interface types) - GitHub - bytecodealliance/witx-bindgen: A language binding generator for `witx` (a precursor to WebAssembly in...

view this post on Zulip Peter Huene (Aug 27 2021 at 01:11):

Additionally, there's wasmlink that can be used to link together independent wasm modules that implement interfaces.

A language binding generator for `witx` (a precursor to WebAssembly interface types) - witx-bindgen/crates/wasmlink at main · bytecodealliance/witx-bindgen

view this post on Zulip Peter Huene (Aug 27 2021 at 01:14):

Looks like I missed the cross post and Dan already replied, so ignore me :)

view this post on Zulip Carl Sverre (Aug 27 2021 at 02:18):

haha no worries - this is very helpful. I switched over to witx-bindgen and everything is working great now! thanks


Last updated: Dec 23 2024 at 13:07 UTC