/// Adds the import to the module's segment.
/// Returns the index of the import in the module (i.e function, table, memory, or global index).
Adds the import to the module's segment.
Returns the index of the import in the module .
Adds the import to the module ' s segment . Returns the index of the import in the module .
pub fn add_import(&mut self, import: Import) -> Result<u32, ModelError> {
        let import_discriminant = discriminant(import.description());
        let imports = self.module.imports.get_or_insert_with(Vec::new);
        let index = u32::try_from(
            imports
                .iter()
                .filter(|i| discriminant(i.description()) == import_discriminant)
                .count(),
        )?;
        imports.push(import);
        Ok(index)
    }
pub fn add_import ( & mut self , import : Import ) -> Result < u32 , ModelError > { let import_discriminant = discriminant ( import . description ( ) ) ; let imports = self . module . imports . get_or_insert_with ( Vec :: new ) ; let index = u32 :: try_from ( imports . iter ( ) . filter ( | i | discriminant ( i . description ( ) ) == import_discriminant ) . count ( ) , ) ? ; imports . push ( import ) ; Ok ( index ) }
Adds the import to the module's segment.
Adds the import to the module ' s segment .
&mut self
import
Import