Struct wasm_encoder::InstanceSection
source · [−]pub struct InstanceSection { /* private fields */ }
Expand description
An encoder for the instance section.
Note that this is part of the module linking proposal and is not currently part of stable WebAssembly.
Example
use wasm_encoder::{Module, InstanceSection, Export};
let mut instances = InstanceSection::new();
instances.instantiate(0, vec![
("x", Export::Function(0)),
("", Export::Module(2)),
("foo", Export::Global(0)),
]);
let mut module = Module::new();
module.section(&instances);
let wasm_bytes = module.finish();
Implementations
sourceimpl InstanceSection
impl InstanceSection
sourcepub fn instantiate<'a, I>(&mut self, module: u32, args: I) -> &mut Self where
I: IntoIterator<Item = (&'a str, Export)>,
I::IntoIter: ExactSizeIterator,
pub fn instantiate<'a, I>(&mut self, module: u32, args: I) -> &mut Self where
I: IntoIterator<Item = (&'a str, Export)>,
I::IntoIter: ExactSizeIterator,
Define an instantiation of the given module with the given items as arguments to the instantiation.
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 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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub 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