[][src]Struct wasm_encoder::InstanceSection

pub struct InstanceSection { /* fields omitted */ }

An encoder for the instance section.

Note that this is part of the module linking proposal and is not currently part of stable WebAssembly.

Example

use wasm_encoder::{Module, InstanceSection, Export};

let mut instances = InstanceSection::new();
instances.instantiate(0, vec![
    ("x", Export::Function(0)),
    ("", Export::Module(2)),
    ("foo", Export::Global(0)),
]);

let mut module = Module::new();
module.section(&instances);

let wasm_bytes = module.finish();

Implementations

impl InstanceSection[src]

pub fn new() -> InstanceSection[src]

Construct a new instance section encoder.

pub fn instantiate<'a, I>(&mut self, module: u32, args: I) -> &mut Self where
    I: IntoIterator<Item = (&'a str, Export)>,
    I::IntoIter: ExactSizeIterator
[src]

Define an instantiation of the given module with the given items as arguments to the instantiation.

Trait Implementations

impl Section for InstanceSection[src]

Auto Trait Implementations

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.