# [−] [src] Trait wasmi::ImportResolver

    pub trait ImportResolver {
        fn resolve_func(
            &self,
            _module_name: &str,
            field_name: &str,
            _signature: &Signature
        ) -> Result<FuncRef, Error>;
        fn resolve_global(
            &self,
            module_name: &str,
            field_name: &str,
            descriptor: &GlobalDescriptor
        ) -> Result<GlobalRef, Error>;
        fn resolve_memory(
            &self,
            module_name: &str,
            field_name: &str,
            descriptor: &MemoryDescriptor
        ) -> Result<MemoryRef, Error>;
        fn resolve_table(
            &self,
            module_name: &str,
            field_name: &str,
            descriptor: &TableDescriptor
        ) -> Result<TableRef, Error>;
    }

Resolver of a module's dependencies.

A module have dependencies in a form of a list of imports (i.e. tuple of a (`module_name`, `field_name`, `descriptor`)).

The job of implementations of this trait is to provide on each import a corresponding concrete reference.

For simple use-cases you can use `ImportsBuilder`.

## Required methods

### `fn resolve_func(
&self,
_module_name: &str,
field_name: &str,
_signature: &Signature
) -> Result<FuncRef, Error>`

Resolve a function.

Returned function should match given `signature`, i.e. all parameter types and return value should have exact match. Otherwise, link-time error will occur.

### `fn resolve_global(
&self,
module_name: &str,
field_name: &str,
descriptor: &GlobalDescriptor
) -> Result<GlobalRef, Error>`

Resolve a global variable.

Returned global should match given `descriptor`, i.e. type and mutability should match. Otherwise, link-time error will occur.

### `fn resolve_memory(
&self,
module_name: &str,
field_name: &str,
descriptor: &MemoryDescriptor
) -> Result<MemoryRef, Error>`

Resolve a memory.

Returned memory should match requested memory (described by the `descriptor`), i.e. initial size of a returned memory should be equal or larger than requested memory. Furthermore, if requested memory have maximum size, returned memory either should have equal or larger maximum size or have no maximum size at all. If returned memory doesn't match the requested then link-time error will occur.

### `fn resolve_table(
&self,
module_name: &str,
field_name: &str,
descriptor: &TableDescriptor
) -> Result<TableRef, Error>`

Resolve a table.

Returned table should match requested table (described by the `descriptor`), i.e. initial size of a returned table should be equal or larger than requested table. Furthermore, if requested memory have maximum size, returned memory either should have equal or larger maximum size or have no maximum size at all. If returned table doesn't match the requested then link-time error will occur.

Loading content...

## Implementors

### `impl<'a> ImportResolver for ImportsBuilder<'a>` [src]

#### `fn resolve_func(
&self,
module_name: &str,
field_name: &str,
signature: &Signature
) -> Result<FuncRef, Error>` [src]

#### `fn resolve_global(
&self,
module_name: &str,
field_name: &str,
global_type: &GlobalDescriptor
) -> Result<GlobalRef, Error>` [src]

#### `fn resolve_memory(
&self,
module_name: &str,
field_name: &str,
memory_type: &MemoryDescriptor
) -> Result<MemoryRef, Error>` [src]

#### `fn resolve_table(
&self,
module_name: &str,
field_name: &str,
table_type: &TableDescriptor
) -> Result<TableRef, Error>` [src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)