fn build_common_tables(
    binary: &[u8],
    tables: &[Table],
    common: &mut impl CommonTables,
) -> BinaryLoaderResult<()> {
    for table in tables {
        match table.kind {
            TableType::MODULE_HANDLES => {
                load_module_handles(binary, table, common.get_module_handles())?;
            }
            TableType::STRUCT_HANDLES => {
                load_struct_handles(binary, table, common.get_struct_handles())?;
            }
            TableType::FUNCTION_HANDLES => {
                load_function_handles(binary, table, common.get_function_handles())?;
            }
            TableType::FUNCTION_INST => {
                load_function_instantiations(binary, table, common.get_function_instantiations())?;
            }
            TableType::SIGNATURES => {
                load_signatures(binary, table, common.get_signatures())?;
            }
            TableType::CONSTANT_POOL => {
                load_constant_pool(binary, table, common.get_constant_pool())?;
            }
            TableType::IDENTIFIERS => {
                load_identifiers(binary, table, common.get_identifiers())?;
            }
            TableType::ADDRESS_IDENTIFIERS => {
                load_address_identifiers(binary, table, common.get_address_identifiers())?;
            }
            TableType::FUNCTION_DEFS
            | TableType::STRUCT_DEFS
            | TableType::STRUCT_DEF_INST
            | TableType::FIELD_HANDLE
            | TableType::FIELD_INST
            | TableType::MAIN
            | TableType::MISC => continue,
        }
    }
    Ok(())
}
/// Builds the common tables in a compiled unit.
Builds the common tables in a compiled unit.
Builds the common tables in a compiled unit .
fn build_common_tables(
    binary: &[u8],
    tables: &[Table],
    common: &mut impl CommonTables,
) -> BinaryLoaderResult<()> {
    for table in tables {
        match table.kind {
            TableType::MODULE_HANDLES => {
                load_module_handles(binary, table, common.get_module_handles())?;
            }
            TableType::STRUCT_HANDLES => {
                load_struct_handles(binary, table, common.get_struct_handles())?;
            }
            TableType::FUNCTION_HANDLES => {
                load_function_handles(binary, table, common.get_function_handles())?;
            }
            TableType::FUNCTION_INST => {
                load_function_instantiations(binary, table, common.get_function_instantiations())?;
            }
            TableType::SIGNATURES => {
                load_signatures(binary, table, common.get_signatures())?;
            }
            TableType::CONSTANT_POOL => {
                load_constant_pool(binary, table, common.get_constant_pool())?;
            }
            TableType::IDENTIFIERS => {
                load_identifiers(binary, table, common.get_identifiers())?;
            }
            TableType::ADDRESS_IDENTIFIERS => {
                load_address_identifiers(binary, table, common.get_address_identifiers())?;
            }
            TableType::FUNCTION_DEFS
            | TableType::STRUCT_DEFS
            | TableType::STRUCT_DEF_INST
            | TableType::FIELD_HANDLE
            | TableType::FIELD_INST
            | TableType::MAIN
            | TableType::MISC => continue,
        }
    }
    Ok(())
}
fn build_common_tables ( binary : & [ u8 ] , tables : & [ Table ] , common : & mut impl CommonTables , ) -> BinaryLoaderResult < ( ) > { for table in tables { match table . kind { TableType :: MODULE_HANDLES => { load_module_handles ( binary , table , common . get_module_handles ( ) ) ? ; } TableType :: STRUCT_HANDLES => { load_struct_handles ( binary , table , common . get_struct_handles ( ) ) ? ; } TableType :: FUNCTION_HANDLES => { load_function_handles ( binary , table , common . get_function_handles ( ) ) ? ; } TableType :: FUNCTION_INST => { load_function_instantiations ( binary , table , common . get_function_instantiations ( ) ) ? ; } TableType :: SIGNATURES => { load_signatures ( binary , table , common . get_signatures ( ) ) ? ; } TableType :: CONSTANT_POOL => { load_constant_pool ( binary , table , common . get_constant_pool ( ) ) ? ; } TableType :: IDENTIFIERS => { load_identifiers ( binary , table , common . get_identifiers ( ) ) ? ; } TableType :: ADDRESS_IDENTIFIERS => { load_address_identifiers ( binary , table , common . get_address_identifiers ( ) ) ? ; } TableType :: FUNCTION_DEFS | TableType :: STRUCT_DEFS | TableType :: STRUCT_DEF_INST | TableType :: FIELD_HANDLE | TableType :: FIELD_INST | TableType :: MAIN | TableType :: MISC => continue , } } Ok ( ( ) ) }
Builds the common tables in a compiled unit.
Builds the common tables in a compiled unit .
binary
&[u8]
tables
&[Table]
common
&mut impl CommonTables
binary
&[u8]
tables
&[Table]
common
&mut impl CommonTables