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

Method instance_pre

crates/wasmtime/src/runtime/component/instance.rs:359–369  ·  view source on GitHub ↗

Returns the [`InstancePre`] that was used to create this instance.

(&self, store: impl AsContext<Data = T>)

Source from the content-addressed store, hash-verified

357
358 /// Returns the [`InstancePre`] that was used to create this instance.
359 pub fn instance_pre<T>(&self, store: impl AsContext<Data = T>) -> InstancePre<T> {
360 // This indexing operation asserts the Store owns the Instance.
361 // Therefore, the InstancePre<T> must match the Store<T>.
362 let data = self.id().get(store.as_context().0);
363
364 // SAFETY: calling this method safely here relies on matching the `T`
365 // in `InstancePre<T>` to the store itself, which is happening in the
366 // type signature just above by ensuring the store's data is `T` which
367 // matches the return value.
368 unsafe { data.instance_pre() }
369 }
370
371 pub(crate) fn id(&self) -> StoreComponentInstanceId {
372 self.id

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
idMethod · 0.45
as_contextMethod · 0.45

Tested by

no test coverage detected