Struct wasm_encoder::CanonicalFunctionSection
source · pub struct CanonicalFunctionSection { /* private fields */ }
Expand description
An encoder for the canonical function section of WebAssembly components.
§Example
use wasm_encoder::{Component, CanonicalFunctionSection, CanonicalOption};
let mut functions = CanonicalFunctionSection::new();
functions.lift(0, 0, [CanonicalOption::UTF8]);
let mut component = Component::new();
component.section(&functions);
let bytes = component.finish();
Implementations§
source§impl CanonicalFunctionSection
impl CanonicalFunctionSection
sourcepub fn lift<O>(
&mut self,
core_func_index: u32,
type_index: u32,
options: O
) -> &mut Self
pub fn lift<O>( &mut self, core_func_index: u32, type_index: u32, options: O ) -> &mut Self
Define a function that will lift a core WebAssembly function to the canonical ABI.
sourcepub fn lower<O>(&mut self, func_index: u32, options: O) -> &mut Self
pub fn lower<O>(&mut self, func_index: u32, options: O) -> &mut Self
Define a function that will lower a canonical ABI function to a core WebAssembly function.
sourcepub fn resource_new(&mut self, ty_index: u32) -> &mut Self
pub fn resource_new(&mut self, ty_index: u32) -> &mut Self
Defines a function which will create an owned handle to the resource
specified by ty_index
.
sourcepub fn resource_drop(&mut self, ty_index: u32) -> &mut Self
pub fn resource_drop(&mut self, ty_index: u32) -> &mut Self
Defines a function which will drop the specified type of handle.
sourcepub fn resource_rep(&mut self, ty_index: u32) -> &mut Self
pub fn resource_rep(&mut self, ty_index: u32) -> &mut Self
Defines a function which will return the representation of the specified resource type.
Trait Implementations§
source§impl Clone for CanonicalFunctionSection
impl Clone for CanonicalFunctionSection
source§fn clone(&self) -> CanonicalFunctionSection
fn clone(&self) -> CanonicalFunctionSection
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 CanonicalFunctionSection
impl Debug for CanonicalFunctionSection
source§impl Default for CanonicalFunctionSection
impl Default for CanonicalFunctionSection
source§fn default() -> CanonicalFunctionSection
fn default() -> CanonicalFunctionSection
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for CanonicalFunctionSection
impl Send for CanonicalFunctionSection
impl Sync for CanonicalFunctionSection
impl Unpin for CanonicalFunctionSection
impl UnwindSafe for CanonicalFunctionSection
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