File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 11use std:: f64:: consts:: PI ;
22
3+ use exports:: more_exports;
4+
35// Use a procedural macro to generate bindings for the world we specified in
46// `host.wit`
57wit_bindgen:: generate!( {
@@ -13,6 +15,7 @@ wit_bindgen::generate!({
1315 exports: {
1416 world: HelloWorldRustWasmComponent ,
1517 "example:hello-world-rust-wasm-component-lib/hello-world-rust-wasm-component-lib-interface" : HelloWorldRustWasmComponent ,
18+ "more-exports/int-box" : IntBox ,
1619 } ,
1720} ) ;
1821
@@ -58,3 +61,15 @@ impl Guest for HelloWorldRustWasmComponent {
5861 return PI * circle. radius * circle. radius ;
5962 }
6063}
64+
65+ pub struct IntBox {
66+ value : u32 ,
67+ }
68+ impl more_exports:: GuestIntBox for IntBox {
69+ fn new ( value : u32 ) -> Self {
70+ Self { value }
71+ }
72+ fn get_value ( & self ) -> u32 {
73+ self . value
74+ }
75+ }
Original file line number Diff line number Diff line change @@ -32,4 +32,11 @@ world hello-world-rust-wasm-component-lib {
3232
3333 use hello-world-rust-wasm-component-lib-interface . {circle };
3434 export compute-area : func (circle : circle ) -> float64 ;
35+
36+ export more-exports : interface {
37+ resource int-box {
38+ constructor (a : u32 );
39+ get-value : func () -> u32 ;
40+ }
41+ }
3542}
You can’t perform that action at this time.
0 commit comments