Add example wasm component and runner which embeds the component
This commit is contained in:
13
component/Cargo.toml
Normal file
13
component/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "component"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
wit-bindgen-rt = { version = "0.24.0", features = ["bitflags"] }
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[package.metadata.component]
|
||||
package = "component:test"
|
||||
14
component/src/lib.rs
Normal file
14
component/src/lib.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
#[allow(warnings)]
|
||||
mod bindings;
|
||||
|
||||
use bindings::{hello, Guest};
|
||||
|
||||
struct Component;
|
||||
|
||||
impl Guest for Component {
|
||||
fn greet() {
|
||||
hello();
|
||||
}
|
||||
}
|
||||
|
||||
bindings::export!(Component with_types_in bindings);
|
||||
6
component/wit/test.wit
Normal file
6
component/wit/test.wit
Normal file
@@ -0,0 +1,6 @@
|
||||
package my:project;
|
||||
|
||||
world test {
|
||||
import hello: func();
|
||||
export greet: func();
|
||||
}
|
||||
Reference in New Issue
Block a user