pub struct ModuleTables { /* private fields */ }Expand description
The set of tables in this module.
Implementations§
Source§impl ModuleTables
impl ModuleTables
Sourcepub fn add_import(
&mut self,
table64: bool,
initial: u64,
maximum: Option<u64>,
element_ty: RefType,
import: ImportId,
) -> TableId
pub fn add_import( &mut self, table64: bool, initial: u64, maximum: Option<u64>, element_ty: RefType, import: ImportId, ) -> TableId
Adds a new imported table to this list of tables
Sourcepub fn add_local(
&mut self,
table64: bool,
initial: u64,
maximum: Option<u64>,
element_ty: RefType,
) -> TableId
pub fn add_local( &mut self, table64: bool, initial: u64, maximum: Option<u64>, element_ty: RefType, ) -> TableId
Construct a new table, that does not originate from any of the input wasm tables.
Sourcepub fn add_local_with_init(
&mut self,
table64: bool,
initial: u64,
maximum: Option<u64>,
element_ty: RefType,
init: Option<ConstExpr>,
) -> TableId
pub fn add_local_with_init( &mut self, table64: bool, initial: u64, maximum: Option<u64>, element_ty: RefType, init: Option<ConstExpr>, ) -> TableId
Construct a new table with an optional initializer expression. The initializer is required for non-defaultable (non-nullable) element types.
Sourcepub fn get_mut(&mut self, table: TableId) -> &mut Table
pub fn get_mut(&mut self, table: TableId) -> &mut Table
Returns the actual table associated with an ID
Sourcepub fn delete(&mut self, id: TableId)
pub fn delete(&mut self, id: TableId)
Removes a table from this module.
It is up to you to ensure that any potential references to the deleted
table are also removed, eg call_indirect expressions and exports, etc.
Sourcepub fn main_function_table(&self) -> Result<Option<TableId>>
pub fn main_function_table(&self) -> Result<Option<TableId>>
Finds a unique function table in a module.
Modules produced by compilers like LLVM typically have one function
table for indirect function calls. This function will look for a single
function table inside this module, and return that if found. If no
function tables are present None will be returned
§Errors
Returns an error if there are two function tables in this module