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
sourceimpl 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
sourceimpl Clone for ComponentInstanceSection
impl Clone for ComponentInstanceSection
sourcefn clone(&self) -> ComponentInstanceSection
fn clone(&self) -> ComponentInstanceSection
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ComponentInstanceSection
impl Debug for ComponentInstanceSection
sourceimpl Default for ComponentInstanceSection
impl Default for ComponentInstanceSection
sourcefn default() -> ComponentInstanceSection
fn default() -> ComponentInstanceSection
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ComponentInstanceSection
impl Send for ComponentInstanceSection
impl Sync for ComponentInstanceSection
impl Unpin for ComponentInstanceSection
impl UnwindSafe for ComponentInstanceSection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more