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:
@@ -82,10 +82,10 @@ fn test_sharing_of_shared_memory() -> Result<()> {
|
||||
]
|
||||
});
|
||||
let instance1_first_word = instance1
|
||||
.get_typed_func::<(), i32, _>(&mut store, "first_word")?
|
||||
.get_typed_func::<(), i32>(&mut store, "first_word")?
|
||||
.call(&mut store, ())?;
|
||||
let instance2_first_word = instance2
|
||||
.get_typed_func::<(), i32, _>(&mut store, "first_word")?
|
||||
.get_typed_func::<(), i32>(&mut store, "first_word")?
|
||||
.call(&mut store, ())?;
|
||||
assert_eq!(shared_memory_first_word, 42);
|
||||
assert_eq!(instance1_first_word, 42);
|
||||
@@ -106,7 +106,7 @@ fn test_probe_shared_memory_size() -> Result<()> {
|
||||
let module = Module::new(&engine, wat)?;
|
||||
let mut store = Store::new(&engine, ());
|
||||
let instance = Instance::new(&mut store, &module, &[])?;
|
||||
let size_fn = instance.get_typed_func::<(), i32, _>(&mut store, "size")?;
|
||||
let size_fn = instance.get_typed_func::<(), i32>(&mut store, "size")?;
|
||||
let mut shared_memory = instance.get_shared_memory(&mut store, "memory").unwrap();
|
||||
|
||||
assert_eq!(size_fn.call(&mut store, ())?, 1);
|
||||
@@ -185,7 +185,7 @@ fn test_grow_memory_in_multiple_threads() -> Result<()> {
|
||||
let mut store = Store::new(&engine, ());
|
||||
let instance = Instance::new(&mut store, &module, &[shared_memory.into()]).unwrap();
|
||||
let grow_fn = instance
|
||||
.get_typed_func::<i32, i32, _>(&mut store, "grow")
|
||||
.get_typed_func::<i32, i32>(&mut store, "grow")
|
||||
.unwrap();
|
||||
let mut thread_local_observed_sizes: Vec<_> = (0..NUM_GROW_OPS / NUM_THREADS)
|
||||
.map(|_| grow_fn.call(&mut store, 1).unwrap() as u32)
|
||||
@@ -260,7 +260,7 @@ fn test_memory_size_accessibility() -> Result<()> {
|
||||
let mut store = Store::new(&engine, ());
|
||||
let instance = Instance::new(&mut store, &module, &[probe_memory.into()]).unwrap();
|
||||
let probe_fn = instance
|
||||
.get_typed_func::<(), i32, _>(&mut store, "probe_last_available")
|
||||
.get_typed_func::<(), i32>(&mut store, "probe_last_available")
|
||||
.unwrap();
|
||||
while !probe_done.load(Ordering::SeqCst) {
|
||||
let value = probe_fn.call(&mut store, ()).unwrap() as u32;
|
||||
|
||||
Reference in New Issue
Block a user