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

Method get_exported_table

crates/wasmtime/src/runtime/vm/instance.rs:641–654  ·  view source on GitHub ↗

Lookup a table by index. # Panics Panics if `index` is out of bounds for this instance.

(&self, store: StoreId, index: TableIndex)

Source from the content-addressed store, hash-verified

639 ///
640 /// Panics if `index` is out of bounds for this instance.
641 pub fn get_exported_table(&self, store: StoreId, index: TableIndex) -> crate::Table {
642 let (id, def_index) = if let Some(def_index) = self.env_module().defined_table_index(index)
643 {
644 (self.id, def_index)
645 } else {
646 let import = self.imported_table(index);
647 // SAFETY: validity of this `Instance` guarantees validity of the
648 // `vmctx` pointer being read here to find the transitive
649 // `InstanceId` that the import is associated with.
650 let id = unsafe { self.sibling_vmctx(import.vmctx.as_non_null()).id };
651 (id, import.index)
652 };
653 crate::Table::from_raw(StoreInstanceId::new(store, id), def_index)
654 }
655
656 /// Lookup a memory by index.
657 ///

Callers 2

generate_table_exportFunction · 0.80

Calls 6

defined_table_indexMethod · 0.80
imported_tableMethod · 0.80
sibling_vmctxMethod · 0.80
newFunction · 0.50
env_moduleMethod · 0.45
as_non_nullMethod · 0.45

Tested by

no test coverage detected