Skip to content

Commit 446337c

Browse files
authored
Generate an instance_pre wrapper in the component bindgen output (#5685)
1 parent 9cd4146 commit 446337c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

crates/wit-bindgen/src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,17 @@ impl Wasmtime {
265265
Ok((Self::new(store, &instance)?, instance))
266266
}}
267267
268+
/// Instantiates a pre-instantiated module using the specified
269+
/// parameters, wrapping up the result in a structure that
270+
/// translates between wasm and the host.
271+
pub {async_} fn instantiate_pre<T {send}>(
272+
mut store: impl wasmtime::AsContextMut<Data = T>,
273+
instance_pre: &wasmtime::component::InstancePre<T>,
274+
) -> anyhow::Result<(Self, wasmtime::component::Instance)> {{
275+
let instance = instance_pre.instantiate{async__}(&mut store){await_}?;
276+
Ok((Self::new(store, &instance)?, instance))
277+
}}
278+
268279
/// Low-level creation wrapper for wrapping up the exports
269280
/// of the `instance` provided in this structure of wasm
270281
/// exports.

0 commit comments

Comments
 (0)