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
)