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