pub struct CanonicalFunctionSection { /* private fields */ }
Available on crate feature
component-model
only.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.
Sourcepub fn thread_spawn(&mut self, ty_index: u32) -> &mut Self
pub fn thread_spawn(&mut self, ty_index: u32) -> &mut Self
Defines a function which will spawns a new thread by invoking a shared
function of type ty_index
.
Sourcepub fn thread_hw_concurrency(&mut self) -> &mut Self
pub fn thread_hw_concurrency(&mut self) -> &mut Self
Defines a function which will return the number of threads that can be expected to execute concurrently.
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 Freeze for CanonicalFunctionSection
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