# [−] [src] Struct wasmi::ImportsBuilder

    pub struct ImportsBuilder<'a> { /* fields omitted */ }

Convenience builder of `ImportResolver`.

With help of this builder, you can easily create `ImportResolver`, just by adding needed resolvers by names.

# Examples

    use wasmi::{ModuleInstance, ImportsBuilder};

    let imports = ImportsBuilder::new()
        .with_resolver("env", &EnvModuleResolver)
        // Note, that ModuleInstance can be a resolver too.
        .with_resolver("other_instance", &other_instance);
    let instance = ModuleInstance::new(&module, &imports)?.assert_no_start();

## Methods

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

#### `pub fn new() -> ImportsBuilder<'a>` [src]

Create an empty `ImportsBuilder`.

#### `pub fn with_resolver<N: Into<String>>(
self,
name: N,
resolver: &'a dyn ModuleImportResolver
) -> Self` [src]

Register an resolver by a name.

#### `pub fn push_resolver<N: Into<String>>(
&mut self,
name: N,
resolver: &'a dyn ModuleImportResolver
)` [src]

Register an resolver by a name.

Mutable borrowed version.

## Trait Implementations

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

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

Resolve a function. Read more

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

Resolve a global variable. Read more

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

Resolve a memory. Read more

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

Resolve a table. Read more

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

#### `fn default() -> Self` [src]

Returns the "default value" for a type. Read more

## Auto Trait Implementations

### `impl<'a> !Send for ImportsBuilder<'a>`

### `impl<'a> !Sync for ImportsBuilder<'a>`

### `impl<'a> Unpin for ImportsBuilder<'a>`

### `impl<'a> !UnwindSafe for ImportsBuilder<'a>`

### `impl<'a> !RefUnwindSafe for ImportsBuilder<'a>`

## Blanket Implementations

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `fn into(self) -> U` [src]

Performs the conversion.

### `impl<T> From<T> for T` [src]

#### `fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

# 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`)