Struct wasm_encoder::InstanceSection 
source · [−]pub struct InstanceSection { /* private fields */ }Expand description
An encoder for the instance section of WebAssembly components.
Example
use wasm_encoder::{Component, InstanceSection, ModuleArg, Export};
let mut instances = InstanceSection::new();
instances.export_core_items([("foo", Export::Function(0))]);
instances.instantiate_module(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_module<'a, Args, Arg>(
    &mut self, 
    module_index: u32, 
    args: Args
) -> &mut Self where
    Args: IntoIterator<Item = (&'a str, Arg)>,
    Args::IntoIter: ExactSizeIterator,
    Arg: Into<ModuleArg>, 
 
pub fn instantiate_module<'a, Args, Arg>(
    &mut self, 
    module_index: u32, 
    args: Args
) -> &mut Self where
    Args: IntoIterator<Item = (&'a str, Arg)>,
    Args::IntoIter: ExactSizeIterator,
    Arg: Into<ModuleArg>, 
Define an instance by instantiating a module.
sourcepub fn export_core_items<'a, Exports, Export>(
    &mut self, 
    exports: Exports
) -> &mut Self where
    Exports: IntoIterator<Item = (&'a str, Export)>,
    Exports::IntoIter: ExactSizeIterator,
    Export: Into<Export>, 
 
pub fn export_core_items<'a, Exports, Export>(
    &mut self, 
    exports: Exports
) -> &mut Self where
    Exports: IntoIterator<Item = (&'a str, Export)>,
    Exports::IntoIter: ExactSizeIterator,
    Export: Into<Export>, 
Define an instance by exporting core WebAssembly items.
sourcepub fn instantiate_component<'a, Args, Arg>(
    &mut self, 
    component_index: u32, 
    args: Args
) -> &mut Self where
    Args: IntoIterator<Item = (&'a str, Arg)>,
    Args::IntoIter: ExactSizeIterator,
    Arg: Into<ComponentArg>, 
 
pub fn instantiate_component<'a, Args, Arg>(
    &mut self, 
    component_index: u32, 
    args: Args
) -> &mut Self where
    Args: IntoIterator<Item = (&'a str, Arg)>,
    Args::IntoIter: ExactSizeIterator,
    Arg: Into<ComponentArg>, 
Define an instance by instantiating a component.
sourcepub fn export_items<'a, Exports, Export>(
    &mut self, 
    exports: Exports
) -> &mut Self where
    Exports: IntoIterator<Item = (&'a str, Export)>,
    Exports::IntoIter: ExactSizeIterator,
    Export: Into<ComponentExport>, 
 
pub fn export_items<'a, Exports, Export>(
    &mut self, 
    exports: Exports
) -> &mut Self where
    Exports: IntoIterator<Item = (&'a str, Export)>,
    Exports::IntoIter: ExactSizeIterator,
    Export: Into<ComponentExport>, 
Define an instance by exporting 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
sourceimpl<T> ToOwned for T where
    T: Clone, 
 
impl<T> ToOwned for T where
    T: Clone, 
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
 
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more