You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wit-bindgen project officially provided by WebAssembly can enable better interaction between the wasm module and the runtime, avoiding the development of various data conversion logics, and now Layotto integrates wasmtime, so we want to integrate wit-bindgen to improve the user's ability to develop wasm modules experience.
2. What I have tried
define a wit file:
record person {
name: string,
age: u32,
}
test: func(who: person) -> string
develop user module
use hello::*;
wit_bindgen_rust::import!("wit/hello.wit");
fn main() {
let p = Person{name:"gj", age: 18};
let result = test(p);
print!("result: {}", result);
}
add implementation in wasmtime
use hello::*;
wit_bindgen_rust::export!("/Users/gujin/workspace/rust/hello-wasmtime/wit/hello.wit");
struct Hello {}
impl hello::Hello for Hello {
fn test(p: Person) -> String {
return p.name;
}
}
//register to wasmtime
In this way, the test function can be implemented, but how to register this implementation with wasmtime and provide services to users has not yet been found.
3. what need to do
Learn how to integrate wit-bindgen with wasmtime
Learn how to integrate wit-bindgen with wasmtime-go
record person {
name: string,
age: u32,
}
test: func(who: person) -> string
用户开发时使用
use hello::*;
wit_bindgen_rust::import!("wit/hello.wit");
fn main() {
let p = Person{name:"gj", age: 18};
let result = test(p);
print!("result: {}", result);
}
1. Background
The wit-bindgen project officially provided by WebAssembly can enable better interaction between the wasm module and the runtime, avoiding the development of various data conversion logics, and now Layotto integrates wasmtime, so we want to integrate wit-bindgen to improve the user's ability to develop wasm modules experience.
2. What I have tried
In this way, the test function can be implemented, but how to register this implementation with wasmtime and provide services to users has not yet been found.
3. what need to do
References:
中文
一、背景
WebAssembly 官方提供的 wit-bindgen 项目可以让 wasm 模块跟运行时之间更好的交互,避免开发各种数据转换逻辑,现在Layotto集成了wasmtime,因此想要集成wit-bindgen来提高用户开发wasm模块的体验。
二、做过的一些尝试
这样可以实现test接口,但是如何把该实现注册到wasmtime,对用户提供服务还没有找到办法。
三、需要做什么
参考资料:
The text was updated successfully, but these errors were encountered: