C API tweaks for wasmtime-py (#2029)

* wasmtime-c-api: Only drop non-null `*mut wasm_ref_t`s

* wasmtime-c-api: Handle null refs in `wasm_val_t` to `Val` conversion

* wasmtime-c-api: Don't unwrap and rewrap `Option`s

The `unwrap` can panic, and there isn't any point to this unwrap+rewrap.

* wasmtime-c-api: Add conversions between `funcref` and `wasm_func_t`

* wasmtime-c-api: More ownership documentation for `wasmtime.h`
This commit is contained in:
Nick Fitzgerald
2020-07-15 17:55:31 -07:00
committed by GitHub
parent c3e8a04c90
commit a9455a8e51
4 changed files with 68 additions and 9 deletions

View File

@@ -91,7 +91,7 @@ pub extern "C" fn wasm_table_get(
index: wasm_table_size_t,
) -> Option<Box<wasm_ref_t>> {
let val = t.table().get(index)?;
Some(val_into_ref(val).unwrap())
val_into_ref(val)
}
#[no_mangle]