Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Feb 20, 2023
1 parent f16158a commit 99a05a0
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions crates/wasmi/src/func/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,21 +246,15 @@ impl<T> HostFuncEntity<T> {
func(caller, params, results)?;
Ok(func_results.encode_results_from_slice(results).unwrap())
});
let signature = engine.alloc_func_type(ty.clone());
Self {
ty: signature,
trampoline,
}
let ty = engine.alloc_func_type(ty.clone());
Self { ty, trampoline }
}

/// Creates a new host function from the given statically typed closure.
pub fn wrap<Params, Results>(engine: &Engine, func: impl IntoFunc<T, Params, Results>) -> Self {
let (signature, trampoline) = func.into_func();
let signature = engine.alloc_func_type(signature);
Self {
ty: signature,
trampoline,
}
let ty = engine.alloc_func_type(signature);
Self { ty, trampoline }
}

/// Returns the signature of the host function.
Expand Down

0 comments on commit 99a05a0

Please sign in to comment.