MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / instantiate_async

Method instantiate_async

crates/wasmtime/src/runtime/instance.rs:933–953  ·  view source on GitHub ↗
(
        &self,
        mut store: impl AsContextMut<Data = T>,
    )

Source from the content-addressed store, hash-verified

931 /// details on Wasmtime's out-of-memory handling.
932 #[cfg(feature = "async")]
933 pub async fn instantiate_async(
934 &self,
935 mut store: impl AsContextMut<Data = T>,
936 ) -> Result<Instance> {
937 let mut store = store.as_context_mut();
938 let imports = pre_instantiate_raw(
939 &mut store.0,
940 &self.module,
941 &self.items,
942 self.host_funcs,
943 &self.func_refs,
944 self.asyncness,
945 )?;
946
947 // This unsafety should be handled by the type-checking performed by the
948 // constructor of `InstancePre` to assert that all the imports we're passing
949 // in match the module we're instantiating.
950 unsafe {
951 Instance::new_started(&mut store, &self.module, imports.as_ref(), Asyncness::Yes).await
952 }
953 }
954}
955
956/// Helper function shared between

Callers

nothing calls this directly

Calls 3

pre_instantiate_rawFunction · 0.85
as_context_mutMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected