wit_bindgen/examples/
_1_interface_imports.rs

1crate::generate!({
2    inline: r#"
3        package example:interface-imports;
4
5        interface logging {
6            enum level {
7                debug,
8                info,
9                warn,
10                error,
11            }
12
13            log: func(level: level, msg: string);
14        }
15
16        world with-imports {
17            // Local interfaces can be imported.
18            import logging;
19
20            // Dependencies can also be referenced, and they're loaded from the
21            // `path` directive specified below.
22            import wasi:cli/environment@0.2.0;
23        }
24    "#,
25
26    path: "wasi-cli@0.2.0.wasm",
27
28    // specify that this interface dependency should be generated as well.
29    with: {
30        "wasi:cli/environment@0.2.0": generate,
31    }
32});