fn build_module_tables(
    binary: &[u8],
    tables: &[Table],
    module: &mut CompiledModuleMut,
) -> BinaryLoaderResult<()> {
    for table in tables {
        match table.kind {
            TableType::STRUCT_DEFS => {
                load_struct_defs(binary, table, &mut module.struct_defs)?;
            }
            TableType::STRUCT_DEF_INST => {
                load_struct_instantiations(binary, table, &mut module.struct_def_instantiations)?;
            }
            TableType::FUNCTION_DEFS => {
                load_function_defs(binary, table, &mut module.function_defs)?;
            }
            TableType::FIELD_HANDLE => {
                load_field_handles(binary, table, &mut module.field_handles)?;
            }
            TableType::FIELD_INST => {
                load_field_instantiations(binary, table, &mut module.field_instantiations)?;
            }
            TableType::MISC => {
                load_miscellaneous_items(binary, table, module)?;
            }
            TableType::MODULE_HANDLES
            | TableType::STRUCT_HANDLES
            | TableType::FUNCTION_HANDLES
            | TableType::FUNCTION_INST
            | TableType::IDENTIFIERS
            | TableType::ADDRESS_IDENTIFIERS
            | TableType::CONSTANT_POOL
            | TableType::SIGNATURES => {
                continue;
            }
            TableType::MAIN => {
                return Err(VMStatus::new(StatusCode::MALFORMED)
                    .with_message("Bad table in Module".to_string()))
            }
        }
    }
    Ok(())
}
/// Builds tables related to a `CompiledModuleMut`.
Builds tables related to a `CompiledModuleMut`.
Builds tables related to a ` CompiledModuleMut ` .
fn build_module_tables(
    binary: &[u8],
    tables: &[Table],
    module: &mut CompiledModuleMut,
) -> BinaryLoaderResult<()> {
    for table in tables {
        match table.kind {
            TableType::STRUCT_DEFS => {
                load_struct_defs(binary, table, &mut module.struct_defs)?;
            }
            TableType::STRUCT_DEF_INST => {
                load_struct_instantiations(binary, table, &mut module.struct_def_instantiations)?;
            }
            TableType::FUNCTION_DEFS => {
                load_function_defs(binary, table, &mut module.function_defs)?;
            }
            TableType::FIELD_HANDLE => {
                load_field_handles(binary, table, &mut module.field_handles)?;
            }
            TableType::FIELD_INST => {
                load_field_instantiations(binary, table, &mut module.field_instantiations)?;
            }
            TableType::MISC => {
                load_miscellaneous_items(binary, table, module)?;
            }
            TableType::MODULE_HANDLES
            | TableType::STRUCT_HANDLES
            | TableType::FUNCTION_HANDLES
            | TableType::FUNCTION_INST
            | TableType::IDENTIFIERS
            | TableType::ADDRESS_IDENTIFIERS
            | TableType::CONSTANT_POOL
            | TableType::SIGNATURES => {
                continue;
            }
            TableType::MAIN => {
                return Err(VMStatus::new(StatusCode::MALFORMED)
                    .with_message("Bad table in Module".to_string()))
            }
        }
    }
    Ok(())
}
fn build_module_tables ( binary : & [ u8 ] , tables : & [ Table ] , module : & mut CompiledModuleMut , ) -> BinaryLoaderResult < ( ) > { for table in tables { match table . kind { TableType :: STRUCT_DEFS => { load_struct_defs ( binary , table , & mut module . struct_defs ) ? ; } TableType :: STRUCT_DEF_INST => { load_struct_instantiations ( binary , table , & mut module . struct_def_instantiations ) ? ; } TableType :: FUNCTION_DEFS => { load_function_defs ( binary , table , & mut module . function_defs ) ? ; } TableType :: FIELD_HANDLE => { load_field_handles ( binary , table , & mut module . field_handles ) ? ; } TableType :: FIELD_INST => { load_field_instantiations ( binary , table , & mut module . field_instantiations ) ? ; } TableType :: MISC => { load_miscellaneous_items ( binary , table , module ) ? ; } TableType :: MODULE_HANDLES | TableType :: STRUCT_HANDLES | TableType :: FUNCTION_HANDLES | TableType :: FUNCTION_INST | TableType :: IDENTIFIERS | TableType :: ADDRESS_IDENTIFIERS | TableType :: CONSTANT_POOL | TableType :: SIGNATURES => { continue ; } TableType :: MAIN => { return Err ( VMStatus :: new ( StatusCode :: MALFORMED ) . with_message ( " " . to_string ( ) ) ) } } } Ok ( ( ) ) }
Builds tables related to a `CompiledModuleMut`.
Builds tables related to a ` CompiledModuleMut ` .
binary
&[u8]
tables
&[Table]
module
&mut CompiledModuleMut
binary
&[u8]
tables
&[Table]
module
&mut CompiledModuleMut