pub struct ComponentInstanceSection { /* private fields */ }
Available on crate feature
component-model
only.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§
source§impl ComponentInstanceSection
impl ComponentInstanceSection
sourcepub fn instantiate<A, S>(&mut self, component_index: u32, args: A) -> &mut Selfwhere
A: IntoIterator<Item = (S, ComponentExportKind, u32)>,
A::IntoIter: ExactSizeIterator,
S: AsRef<str>,
pub fn instantiate<A, S>(&mut self, component_index: u32, args: A) -> &mut Selfwhere
A: IntoIterator<Item = (S, ComponentExportKind, u32)>,
A::IntoIter: ExactSizeIterator,
S: AsRef<str>,
Define an instance by instantiating a component.
sourcepub fn export_items<'a, E>(&mut self, exports: E) -> &mut Self
pub fn export_items<'a, E>(&mut self, exports: E) -> &mut Self
Define an instance by exporting items.
Trait Implementations§
source§impl Clone for ComponentInstanceSection
impl Clone for ComponentInstanceSection
source§fn clone(&self) -> ComponentInstanceSection
fn clone(&self) -> ComponentInstanceSection
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 Debug for ComponentInstanceSection
impl Debug for ComponentInstanceSection
source§impl Default for ComponentInstanceSection
impl Default for ComponentInstanceSection
source§fn default() -> ComponentInstanceSection
fn default() -> ComponentInstanceSection
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ComponentInstanceSection
impl RefUnwindSafe for ComponentInstanceSection
impl Send for ComponentInstanceSection
impl Sync for ComponentInstanceSection
impl Unpin for ComponentInstanceSection
impl UnwindSafe for ComponentInstanceSection
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
)