@@ -38,7 +38,12 @@ contents to `runnable-example/wit/component.wit`:
3838``` wit
3939package example:runnable;
4040
41+ interface greet {
42+ greet: func(name: string) -> string;
43+ }
44+
4145world greeter {
46+ export greet;
4247 export wasi:cli/run@0.2.7;
4348}
4449```
@@ -76,8 +81,16 @@ mod bindings {
7681/// Component off of which implementation will hang (this can be named anything)
7782struct Component ;
7883
79- export bindings :: wasi :: cli :: run :: Guest for Component {
80- fn run (& self ) -> Result <(), ()> {
84+ /// Implementation for the `greet` interface export
85+ impl bindings :: exports :: example :: runnable :: greet :: Guest for Component {
86+ fn greet (name : String ) -> String {
87+ format! (" Hello {name}!" )
88+ }
89+ }
90+
91+ /// Implementation for `wasi:cli/run` interface export
92+ impl bindings :: exports :: wasi :: cli :: run :: Guest for Component {
93+ fn run () -> Result <(), ()> {
8194 eprintln! (" Hello World!" );
8295 Ok (())
8396 }
@@ -92,6 +105,12 @@ To build the component, use `cargo`:
92105cargo build --target=wasm32-wasip2
93106```
94107
108+ The component can also be built in release mode:
109+
110+ ``` console
111+ cargo build --target=wasm32-wasip2 --release
112+ ```
113+
95114### 5. Run the component with ` wasmtime `
96115
97116You can run the component with ` wasmtime ` , and unlike a generic reactor component, you do not need to specify
@@ -142,6 +161,12 @@ To build the component, use `cargo`:
142161cargo build --target=wasm32-wasip2
143162```
144163
164+ The component can also be built in release mode:
165+
166+ ``` console
167+ cargo build --target=wasm32-wasip2 --release
168+ ```
169+
145170### 4. Run the component with ` wasmtime `
146171
147172To run your command component:
0 commit comments