/// Adds the table to the module's segment.
/// Returns the index of the table in the module.
///
/// **Note:** In order for the returned index to be accurate,
/// all table imports must be defined prior to adding any tables.
Adds the table to the module's segment.
Returns the index of the table in the module.

In order for the returned index to be accurate,
all table imports must be defined prior to adding any tables.
Adds the table to the module ' s segment . Returns the index of the table in the module . In order for the returned index to be accurate all table imports must be defined prior to adding any tables .
pub fn add_table(&mut self, table: Table) -> Result<TableIndex, ModelError> {
        let tables = self.module.tables.get_or_insert_with(Vec::new);
        let imports = match &self.module.imports {
            Some(imports) => imports
                .iter()
                .filter(|import| matches!(import.description(), ImportDescription::Table(_)))
                .count(),
            None => 0,
        };
        let index = u32::try_from(tables.len() + imports)?;
        tables.push(table);
        Ok(index)
    }
pub fn add_table ( & mut self , table : Table ) -> Result < TableIndex , ModelError > { let tables = self . module . tables . get_or_insert_with ( Vec :: new ) ; let imports = match & self . module . imports { Some ( imports ) => imports . iter ( ) . filter ( | import | matches ! ( import description ( ) ImportDescription Table ( ) ) ) . count ( ) , None => 0 , } ; let index = u32 :: try_from ( tables . len ( ) + imports ) ? ; tables . push ( table ) ; Ok ( index ) }
Adds the table to the module's segment.
Adds the table to the module ' s segment .
&mut self
table
Table