Remove explicit S type parameters (#5275)

* Remove explicit `S` type parameters

This commit removes the explicit `S` type parameter on `Func::typed` and
`Instance::get_typed_func`. Historical versions of Rust required that
this be a type parameter but recent rustcs support a mixture of explicit
type parameters and `impl Trait`. This removes, at callsites, a
superfluous `, _` argument which otherwise never needs specification.

* Fix mdbook examples
This commit is contained in:
Alex Crichton
2022-11-15 23:04:26 -06:00
committed by GitHub
parent 8426904129
commit b0939f6626
50 changed files with 223 additions and 238 deletions

View File

@@ -25,16 +25,16 @@ fn main() -> Result<()> {
let memory0 = instance
.get_memory(&mut store, "memory0")
.ok_or(anyhow::format_err!("failed to find `memory0` export"))?;
let size0 = instance.get_typed_func::<(), i32, _>(&mut store, "size0")?;
let load0 = instance.get_typed_func::<i32, i32, _>(&mut store, "load0")?;
let store0 = instance.get_typed_func::<(i32, i32), (), _>(&mut store, "store0")?;
let size0 = instance.get_typed_func::<(), i32>(&mut store, "size0")?;
let load0 = instance.get_typed_func::<i32, i32>(&mut store, "load0")?;
let store0 = instance.get_typed_func::<(i32, i32), ()>(&mut store, "store0")?;
let memory1 = instance
.get_memory(&mut store, "memory1")
.ok_or(anyhow::format_err!("failed to find `memory1` export"))?;
let size1 = instance.get_typed_func::<(), i32, _>(&mut store, "size1")?;
let load1 = instance.get_typed_func::<i32, i32, _>(&mut store, "load1")?;
let store1 = instance.get_typed_func::<(i32, i32), (), _>(&mut store, "store1")?;
let size1 = instance.get_typed_func::<(), i32>(&mut store, "size1")?;
let load1 = instance.get_typed_func::<i32, i32>(&mut store, "load1")?;
let store1 = instance.get_typed_func::<(i32, i32), ()>(&mut store, "store1")?;
println!("Checking memory...");
assert_eq!(memory0.size(&store), 2);