Hello there, I am using wit-bindgen 0.3.0, and I wanted to gather all my types like this :
interface types {
variant error {
invalid-value(string)
}
record plugin-info {
name: string,
description: string,
version: string,
icon: option<string>,
url: option<string>
}
record plugin-config {
fs-access: list<fs-access>,
}
record fs-access {
host-path: string,
fsnotify: bool
}
record entry {
title: string,
description: string,
preview: option<string>
}
}
interface michel-api {
use self.types.{entry}
hi: func(name: string) -> string
send-entry-for-input: func(input: string, entries: list<entry>)
}
interface plugin-api {
use self.types.{plugin-info, plugin-config, entry, error}
info: func() -> plugin-info
config: func() -> plugin-config
update-config: func(config: plugin-config) -> result<_, error>
for-input: func(input: string) -> list<entry>
autocomplete: func(input: string) -> option<string>
bahouais: func() -> string
}
default world michel {
import michel-api: self.michel-api
export plugin-api: self.plugin-api
}
The online editor tells me that my wit file is ok, but the macro doesn't know where to find the objects, I have errors like this :
error[E0422]: cannot find struct, variant or union type `EntryParam` in this scope
--> src/lib.rs:7:1
|
7 | wit_bindgen::generate!("plugin" in "../wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: consider importing this struct:
crate::types::EntryParam
= note: this error originates in the macro `wit_bindgen::generate` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `PluginConfig` in module `super::types`
--> src/lib.rs:7:1
|
7 | wit_bindgen::generate!("plugin" in "../wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `super::types`
|
= note: this error originates in the macro `wit_bindgen::generate` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Entry` in module `super::types`
--> src/lib.rs:7:1
|
7 | wit_bindgen::generate!("plugin" in "../wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `super::types`
And more errors like this. What did went wrong?
Oh, well, I changed my wit-bindgen from "0.3.0" to the git repo url, and this is now working..
bachrc has marked this topic as resolved.
Last updated: Nov 22 2024 at 17:03 UTC