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
sourceimpl InstanceSection
impl InstanceSection
sourcepub fn instantiate<'a, A>(&mut self, module_index: u32, args: A) -> &mut Self where
A: IntoIterator<Item = (&'a str, ModuleArg)>,
A::IntoIter: ExactSizeIterator,
pub fn instantiate<'a, A>(&mut self, module_index: u32, args: A) -> &mut Self where
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 Self where
E: IntoIterator<Item = (&'a str, ExportKind, u32)>,
E::IntoIter: ExactSizeIterator,
pub fn export_items<'a, E>(&mut self, exports: E) -> &mut Self where
E: IntoIterator<Item = (&'a str, ExportKind, u32)>,
E::IntoIter: ExactSizeIterator,
Define an instance by exporting core WebAssembly items.
Trait Implementations
sourceimpl Clone for InstanceSection
impl Clone for InstanceSection
sourcefn clone(&self) -> InstanceSection
fn clone(&self) -> InstanceSection
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 more
sourceimpl ComponentSection for InstanceSection
impl ComponentSection for InstanceSection
sourceimpl Debug for InstanceSection
impl Debug for InstanceSection
sourceimpl Default for InstanceSection
impl Default for InstanceSection
sourcefn default() -> InstanceSection
fn default() -> InstanceSection
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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