Struct wasmer_runtime_fl::ImportObject[][src]

pub struct ImportObject {
    pub allow_missing_functions: bool,
    // some fields omitted
}
Expand description

All of the import data used when instantiating.

It’s suggested that you use the imports! macro instead of creating an ImportObject by hand.

Usage:

let import_object = imports! {
    "env" => {
        "foo" => func!(foo),
    },
};

fn foo(_: &mut Ctx, n: i32) -> i32 {
    n
}

Fields

allow_missing_functions: bool

Allow missing functions to be generated and instantiation to continue when required functions are not provided.

Implementations

Create a new ImportObject.

Create a new ImportObject which generates data from the provided state creator.

Register anything that implements LikeNamespace as a namespace.

Usage:

fn register(instance: Instance, namespace: Namespace) {
    let mut import_object = ImportObject::new();

    import_object.register("namespace0", instance);
    import_object.register("namespace1", namespace);
    // ...
}

Apply a function on the namespace if it exists If your function can fail, consider using maybe_with_namespace

The same as with_namespace but takes a function that may fail

Usage:

fn get_export(imports: &ImportObject, namespace: &str, name: &str) -> Option<Export> {
    imports.maybe_with_namespace(namespace, |ns| ns.get_export(name))
}

Returns true if the ImportObject contains namespace with the provided name.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.