[][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();

Implementations

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> Default for ImportsBuilder<'a>[src]

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

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

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

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.

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.