pub fn lookup(&mut self, field: &str) -> Option<Export> {
        let contents = self.mmap_field.contents_mut();
        if let Some(export) = self.module.exports.get(field) {
            Some(match export {
                wasmtime_environ::Export::Function(index) => {
                    let signature = self.module.signatures[self.module.functions[*index]].clone();
                    let (address, vmctx) =
                        if let Some(def_index) = self.module.defined_func_index(*index) {
                            (
                                contents.finished_functions[def_index],
                                &mut contents.vmctx as *mut VMContext,
                            )
                        } else {
                            let import = contents.imported_function(*index);
                            (import.body, import.vmctx)
                        };
                    Export::Function {
                        address,
                        signature,
                        vmctx,
                    }
                }
                wasmtime_environ::Export::Table(index) => {
                    let (definition, vmctx) =
                        if let Some(def_index) = self.module.defined_table_index(*index) {
                            (
                                contents.table_mut(def_index) as *mut VMTableDefinition,
                                &mut contents.vmctx as *mut VMContext,
                            )
                        } else {
                            let import = contents.imported_table(*index);
                            (import.from, import.vmctx)
                        };
                    Export::Table {
                        definition,
                        vmctx,
                        table: self.module.table_plans[*index].clone(),
                    }
                }
                wasmtime_environ::Export::Memory(index) => {
                    let (definition, vmctx) =
                        if let Some(def_index) = self.module.defined_memory_index(*index) {
                            (
                                contents.memory_mut(def_index) as *mut VMMemoryDefinition,
                                &mut contents.vmctx as *mut VMContext,
                            )
                        } else {
                            let import = contents.imported_memory(*index);
                            (import.from, import.vmctx)
                        };
                    Export::Memory {
                        definition,
                        vmctx,
                        memory: self.module.memory_plans[*index].clone(),
                    }
                }
                wasmtime_environ::Export::Global(index) => Export::Global {
                    definition: if let Some(def_index) = self.module.defined_global_index(*index) {
                        contents.global_mut(def_index)
                    } else {
                        contents.imported_global(*index).from
                    },
                    global: self.module.globals[*index],
                },
            })
        } else {
            None
        }
    }
/// Lookup an export with the given name.
Lookup an export with the given name.
Lookup an export with the given name .
pub fn lookup(&mut self, field: &str) -> Option<Export> {
        let contents = self.mmap_field.contents_mut();
        if let Some(export) = self.module.exports.get(field) {
            Some(match export {
                wasmtime_environ::Export::Function(index) => {
                    let signature = self.module.signatures[self.module.functions[*index]].clone();
                    let (address, vmctx) =
                        if let Some(def_index) = self.module.defined_func_index(*index) {
                            (
                                contents.finished_functions[def_index],
                                &mut contents.vmctx as *mut VMContext,
                            )
                        } else {
                            let import = contents.imported_function(*index);
                            (import.body, import.vmctx)
                        };
                    Export::Function {
                        address,
                        signature,
                        vmctx,
                    }
                }
                wasmtime_environ::Export::Table(index) => {
                    let (definition, vmctx) =
                        if let Some(def_index) = self.module.defined_table_index(*index) {
                            (
                                contents.table_mut(def_index) as *mut VMTableDefinition,
                                &mut contents.vmctx as *mut VMContext,
                            )
                        } else {
                            let import = contents.imported_table(*index);
                            (import.from, import.vmctx)
                        };
                    Export::Table {
                        definition,
                        vmctx,
                        table: self.module.table_plans[*index].clone(),
                    }
                }
                wasmtime_environ::Export::Memory(index) => {
                    let (definition, vmctx) =
                        if let Some(def_index) = self.module.defined_memory_index(*index) {
                            (
                                contents.memory_mut(def_index) as *mut VMMemoryDefinition,
                                &mut contents.vmctx as *mut VMContext,
                            )
                        } else {
                            let import = contents.imported_memory(*index);
                            (import.from, import.vmctx)
                        };
                    Export::Memory {
                        definition,
                        vmctx,
                        memory: self.module.memory_plans[*index].clone(),
                    }
                }
                wasmtime_environ::Export::Global(index) => Export::Global {
                    definition: if let Some(def_index) = self.module.defined_global_index(*index) {
                        contents.global_mut(def_index)
                    } else {
                        contents.imported_global(*index).from
                    },
                    global: self.module.globals[*index],
                },
            })
        } else {
            None
        }
    }
pub fn lookup ( & mut self , field : & str ) -> Option < Export > { let contents = self . mmap_field . contents_mut ( ) ; if let Some ( export ) = self . module . exports . get ( field ) { Some ( match export { wasmtime_environ :: Export :: Function ( index ) => { let signature = self . module . signatures [ self . module . functions [ * index ] ] . clone ( ) ; let ( address , vmctx ) = if let Some ( def_index ) = self . module . defined_func_index ( * index ) { ( contents . finished_functions [ def_index ] , & mut contents . vmctx as * mut VMContext , ) } else { let import = contents . imported_function ( * index ) ; ( import . body , import . vmctx ) } ; Export :: Function { address , signature , vmctx , } } wasmtime_environ :: Export :: Table ( index ) => { let ( definition , vmctx ) = if let Some ( def_index ) = self . module . defined_table_index ( * index ) { ( contents . table_mut ( def_index ) as * mut VMTableDefinition , & mut contents . vmctx as * mut VMContext , ) } else { let import = contents . imported_table ( * index ) ; ( import . from , import . vmctx ) } ; Export :: Table { definition , vmctx , table : self . module . table_plans [ * index ] . clone ( ) , } } wasmtime_environ :: Export :: Memory ( index ) => { let ( definition , vmctx ) = if let Some ( def_index ) = self . module . defined_memory_index ( * index ) { ( contents . memory_mut ( def_index ) as * mut VMMemoryDefinition , & mut contents . vmctx as * mut VMContext , ) } else { let import = contents . imported_memory ( * index ) ; ( import . from , import . vmctx ) } ; Export :: Memory { definition , vmctx , memory : self . module . memory_plans [ * index ] . clone ( ) , } } wasmtime_environ :: Export :: Global ( index ) => Export :: Global { definition : if let Some ( def_index ) = self . module . defined_global_index ( * index ) { contents . global_mut ( def_index ) } else { contents . imported_global ( * index ) . from } , global : self . module . globals [ * index ] , } , } ) } else { None } }
Lookup an export with the given name.
Lookup an export with the given name .
&mut self
field
&str