Propagate optional import names to the wasmtime/C API

With the module linking proposal the field name on imports is now
optional, and only the module is required to be specified. This commit
propagates this API change to the boundary of wasmtime's API, ensuring
consumers are aware of what's optional with module linking and what
isn't. Note that it's expected that all existing users will either
update accordingly or unwrap the result since module linking is
presumably disabled.
This commit is contained in:
Alex Crichton
2020-11-23 15:17:34 -08:00
parent 1dd20b4371
commit 62be6841e4
18 changed files with 132 additions and 93 deletions

View File

@@ -328,7 +328,7 @@ pub extern "C" fn wasi_instance_bind_import<'a>(
import: &wasm_importtype_t,
) -> Option<&'a wasm_extern_t> {
let module = &import.module;
let name = str::from_utf8(import.name.as_bytes()).ok()?;
let name = str::from_utf8(import.name.as_ref()?.as_bytes()).ok()?;
let export = match &instance.wasi {
WasiInstance::Preview1(wasi) => {