Make Func::getN return a Result rather than an Option (#966)

This allows getN to return a detailed explanation of any type signature
mismatch, and makes it easy to just use `?` on the result of getN rather
than constructing a (necessarily vaguer) error message in the caller.
This commit is contained in:
Josh Triplett
2020-02-22 15:56:23 -08:00
committed by GitHub
parent 48202e0c31
commit aa78d491b0
3 changed files with 86 additions and 65 deletions

View File

@@ -38,8 +38,8 @@ impl wasmtime::WasmTy for WasiCallerMemory {
fn push(_dst: &mut Vec<wasmtime::ValType>) {}
fn matches(_tys: impl Iterator<Item = wasmtime::ValType>) -> bool {
true
fn matches(_tys: impl Iterator<Item = wasmtime::ValType>) -> anyhow::Result<()> {
Ok(())
}
fn from_abi(vmctx: *mut wasmtime_runtime::VMContext, _abi: ()) -> Self {