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, S>(&mut self, module_index: u32, args: A) -> &mut Self
pub fn instantiate<A, S>(&mut self, module_index: u32, args: A) -> &mut Self
Define an instance by instantiating a core module.
sourcepub fn export_items<E, S>(&mut self, exports: E) -> &mut Self
pub fn export_items<E, S>(&mut self, exports: E) -> &mut Self
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
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more