Struct wasm_encoder::InstanceSection
source · pub struct InstanceSection { /* private fields */ }
Expand description
An encoder for the core instance section of WebAssembly components.
Example
use wasm_encoder::{Component, InstanceSection, ExportKind, ModuleArg};
let mut instances = InstanceSection::new();
instances.export_items([("foo", ExportKind::Func, 0)]);
instances.instantiate(1, [("foo", ModuleArg::Instance(0))]);
let mut component = Component::new();
component.section(&instances);
let bytes = component.finish();
Implementations§
source§impl InstanceSection
impl InstanceSection
sourcepub fn instantiate<'a, A>(&mut self, module_index: u32, args: A) -> &mut Selfwhere
A: IntoIterator<Item = (&'a str, ModuleArg)>,
A::IntoIter: ExactSizeIterator,
pub fn instantiate<'a, A>(&mut self, module_index: u32, args: A) -> &mut Selfwhere A: IntoIterator<Item = (&'a str, ModuleArg)>, A::IntoIter: ExactSizeIterator,
Define an instance by instantiating a core module.
sourcepub fn export_items<'a, E>(&mut self, exports: E) -> &mut Selfwhere
E: IntoIterator<Item = (&'a str, ExportKind, u32)>,
E::IntoIter: ExactSizeIterator,
pub fn export_items<'a, E>(&mut self, exports: E) -> &mut Selfwhere E: IntoIterator<Item = (&'a str, ExportKind, u32)>, E::IntoIter: ExactSizeIterator,
Define an instance by exporting core WebAssembly items.
Trait Implementations§
source§impl Clone for InstanceSection
impl Clone for InstanceSection
source§fn clone(&self) -> InstanceSection
fn clone(&self) -> InstanceSection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl ComponentSection for InstanceSection
impl ComponentSection for InstanceSection
source§impl Debug for InstanceSection
impl Debug for InstanceSection
source§impl Default for InstanceSection
impl Default for InstanceSection
source§fn default() -> InstanceSection
fn default() -> InstanceSection
Returns the “default value” for a type. Read more