Struct wasm_encoder::adapter::InstanceSection [−][src]
pub struct InstanceSection { /* fields omitted */ }
Expand description
An encoder for the adapter module instance section.
Example
use wasm_encoder::adapter::{AdapterModule, InstanceSection, IndexRef};
// This assumes there is a module with index 0, a function with index 0,
// a module with index 2, and a global with index 0.
let mut instances = InstanceSection::new();
instances.instantiate(0, [
("x", IndexRef::Function(0)),
("", IndexRef::Module(2)),
("foo", IndexRef::Global(0)),
]);
let mut module = AdapterModule::new();
module.section(&instances);
let bytes = module.finish();
Implementations
pub fn instantiate<'a, I>(&mut self, module: u32, args: I) -> &mut Self where
I: IntoIterator<Item = (&'a str, IndexRef)>,
I::IntoIter: ExactSizeIterator,
pub fn instantiate<'a, I>(&mut self, module: u32, args: I) -> &mut Self where
I: IntoIterator<Item = (&'a str, IndexRef)>,
I::IntoIter: ExactSizeIterator,
Define an instantiation of the given module with the given arguments to the instantiation.
pub fn exports<'a, E>(&mut self, exports: E) -> &mut Self where
E: IntoIterator<Item = (&'a str, IndexRef)>,
E::IntoIter: ExactSizeIterator,
pub fn exports<'a, E>(&mut self, exports: E) -> &mut Self where
E: IntoIterator<Item = (&'a str, IndexRef)>,
E::IntoIter: ExactSizeIterator,
Define an instance by exporting the given exports.
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for InstanceSection
impl Send for InstanceSection
impl Sync for InstanceSection
impl Unpin for InstanceSection
impl UnwindSafe for InstanceSection
Blanket Implementations
Mutably borrows from an owned value. Read more