wasmtime/runtime/component/bindgen_examples/
_8_store_in_imports.rs

1bindgen!({
2    inline: r#"
3        package example:store-in-imports;
4
5        world my-world {
6            import sync-with-store: func();
7            import async-with-store: async func();
8
9            import sync-without-store: func();
10            import async-without-store: func();
11
12            export run: async func();
13        }
14    "#,
15
16    imports: {
17        "sync-with-store": store,
18        // note that this isn't required because WIT-level `async` functions
19        // always have access to the store.
20        // "async-with-store": store,
21        "async-without-store": async,
22    },
23});