pub struct InstanceSection { /* private fields */ }
Available on crate feature
component-model
only.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 Freeze for InstanceSection
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)