pub struct CanonicalFunctionSection { /* private fields */ }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_ref(&mut self, ty_index: u32) -> &mut Self
pub fn thread_spawn_ref(&mut self, ty_index: u32) -> &mut Self
Defines a function which will spawn a new thread by invoking a shared
function of type ty_index.
Sourcepub fn thread_spawn_indirect(
&mut self,
ty_index: u32,
table_index: u32,
) -> &mut Self
pub fn thread_spawn_indirect( &mut self, ty_index: u32, table_index: u32, ) -> &mut Self
Defines a function which will spawn a new thread by invoking a shared
function indirectly through a funcref table.
Sourcepub fn thread_available_parallelism(&mut self) -> &mut Self
pub fn thread_available_parallelism(&mut self) -> &mut Self
Defines a function which will return the number of threads that can be expected to execute concurrently.
Sourcepub fn backpressure_inc(&mut self) -> &mut Self
pub fn backpressure_inc(&mut self) -> &mut Self
Defines a function which tells the host to increment the backpressure counter.
Sourcepub fn backpressure_dec(&mut self) -> &mut Self
pub fn backpressure_dec(&mut self) -> &mut Self
Defines a function which tells the host to decrement the backpressure counter.
Sourcepub fn task_return<O>(
&mut self,
ty: Option<ComponentValType>,
options: O,
) -> &mut Self
pub fn task_return<O>( &mut self, ty: Option<ComponentValType>, options: O, ) -> &mut Self
Defines a function which returns a result to the caller of a lifted export function. This allows the callee to continue executing after returning a result.
Sourcepub fn task_cancel(&mut self) -> &mut Self
pub fn task_cancel(&mut self) -> &mut Self
Defines a function to acknowledge cancellation of the current task.
Sourcepub fn context_get(&mut self, ty: ValType, i: u32) -> &mut Self
pub fn context_get(&mut self, ty: ValType, i: u32) -> &mut Self
Defines a new context.get intrinsic of the ith slot with the given
value type.
Sourcepub fn context_set(&mut self, ty: ValType, i: u32) -> &mut Self
pub fn context_set(&mut self, ty: ValType, i: u32) -> &mut Self
Defines a new context.set intrinsic of the ith slot with the given
value type.
Sourcepub fn subtask_drop(&mut self) -> &mut Self
pub fn subtask_drop(&mut self) -> &mut Self
Defines a function to drop a specified task which has completed.
Sourcepub fn subtask_cancel(&mut self, async_: bool) -> &mut Self
pub fn subtask_cancel(&mut self, async_: bool) -> &mut Self
Defines a function to cancel an in-progress task.
Sourcepub fn stream_new(&mut self, ty: u32) -> &mut Self
pub fn stream_new(&mut self, ty: u32) -> &mut Self
Defines a function to create a new stream handle of the specified
type.
Sourcepub fn stream_read<O>(&mut self, ty: u32, options: O) -> &mut Self
pub fn stream_read<O>(&mut self, ty: u32, options: O) -> &mut Self
Defines a function to read from a stream of the specified type.
Sourcepub fn stream_write<O>(&mut self, ty: u32, options: O) -> &mut Self
pub fn stream_write<O>(&mut self, ty: u32, options: O) -> &mut Self
Defines a function to write to a stream of the specified type.
Sourcepub fn stream_cancel_read(&mut self, ty: u32, async_: bool) -> &mut Self
pub fn stream_cancel_read(&mut self, ty: u32, async_: bool) -> &mut Self
Defines a function to cancel an in-progress read from a stream of the
specified type.
Sourcepub fn stream_cancel_write(&mut self, ty: u32, async_: bool) -> &mut Self
pub fn stream_cancel_write(&mut self, ty: u32, async_: bool) -> &mut Self
Defines a function to cancel an in-progress write to a stream of the
specified type.
Sourcepub fn stream_drop_readable(&mut self, ty: u32) -> &mut Self
pub fn stream_drop_readable(&mut self, ty: u32) -> &mut Self
Defines a function to drop the readable end of a stream of the
specified type.
Sourcepub fn stream_drop_writable(&mut self, ty: u32) -> &mut Self
pub fn stream_drop_writable(&mut self, ty: u32) -> &mut Self
Defines a function to drop the writable end of a stream of the
specified type.
Sourcepub fn future_new(&mut self, ty: u32) -> &mut Self
pub fn future_new(&mut self, ty: u32) -> &mut Self
Defines a function to create a new future handle of the specified
type.
Sourcepub fn future_read<O>(&mut self, ty: u32, options: O) -> &mut Self
pub fn future_read<O>(&mut self, ty: u32, options: O) -> &mut Self
Defines a function to read from a future of the specified type.
Sourcepub fn future_write<O>(&mut self, ty: u32, options: O) -> &mut Self
pub fn future_write<O>(&mut self, ty: u32, options: O) -> &mut Self
Defines a function to write to a future of the specified type.
Sourcepub fn future_cancel_read(&mut self, ty: u32, async_: bool) -> &mut Self
pub fn future_cancel_read(&mut self, ty: u32, async_: bool) -> &mut Self
Defines a function to cancel an in-progress read from a future of the
specified type.
Sourcepub fn future_cancel_write(&mut self, ty: u32, async_: bool) -> &mut Self
pub fn future_cancel_write(&mut self, ty: u32, async_: bool) -> &mut Self
Defines a function to cancel an in-progress write to a future of the
specified type.
Sourcepub fn future_drop_readable(&mut self, ty: u32) -> &mut Self
pub fn future_drop_readable(&mut self, ty: u32) -> &mut Self
Defines a function to drop the readable end of a future of the
specified type.
Sourcepub fn future_drop_writable(&mut self, ty: u32) -> &mut Self
pub fn future_drop_writable(&mut self, ty: u32) -> &mut Self
Defines a function to drop the writable end of a future of the
specified type.
Sourcepub fn error_context_new<O>(&mut self, options: O) -> &mut Self
pub fn error_context_new<O>(&mut self, options: O) -> &mut Self
Defines a function to create a new error-context with a specified
debug message.
Sourcepub fn error_context_debug_message<O>(&mut self, options: O) -> &mut Self
pub fn error_context_debug_message<O>(&mut self, options: O) -> &mut Self
Defines a function to get the debug message for a specified
error-context.
Note that the debug message might not necessarily match what was passed
to error-context.new.
Sourcepub fn error_context_drop(&mut self) -> &mut Self
pub fn error_context_drop(&mut self) -> &mut Self
Defines a function to drop a specified error-context.
Sourcepub fn waitable_set_new(&mut self) -> &mut Self
pub fn waitable_set_new(&mut self) -> &mut Self
Declare a new waitable-set.new intrinsic, used to create a
waitable-set pseudo-resource.
Sourcepub fn waitable_set_wait(&mut self, async_: bool, memory: u32) -> &mut Self
pub fn waitable_set_wait(&mut self, async_: bool, memory: u32) -> &mut Self
Declare a new waitable-set.wait intrinsic, used to block on a
waitable-set.
Sourcepub fn waitable_set_poll(&mut self, async_: bool, memory: u32) -> &mut Self
pub fn waitable_set_poll(&mut self, async_: bool, memory: u32) -> &mut Self
Declare a new waitable-set.wait intrinsic, used to check, without
blocking, if anything in a waitable-set is ready.
Sourcepub fn waitable_set_drop(&mut self) -> &mut Self
pub fn waitable_set_drop(&mut self) -> &mut Self
Declare a new waitable-set.drop intrinsic, used to dispose a
waitable-set pseudo-resource.
Sourcepub fn waitable_join(&mut self) -> &mut Self
pub fn waitable_join(&mut self) -> &mut Self
Declare a new waitable.join intrinsic, used to add an item to a
waitable-set.
Sourcepub fn thread_index(&mut self) -> &mut Self
pub fn thread_index(&mut self) -> &mut Self
Declare a new thread.index intrinsic, used to get the index of the
current thread.
Sourcepub fn thread_new_indirect(
&mut self,
ty_index: u32,
table_index: u32,
) -> &mut Self
pub fn thread_new_indirect( &mut self, ty_index: u32, table_index: u32, ) -> &mut Self
Declare a new thread.new-indirect intrinsic, used to create a new
thread by invoking a function indirectly through a funcref table.
Sourcepub fn thread_resume_later(&mut self) -> &mut Self
pub fn thread_resume_later(&mut self) -> &mut Self
Declare a new thread.resume-later intrinsic.
Sourcepub fn thread_suspend(&mut self, cancellable: bool) -> &mut Self
pub fn thread_suspend(&mut self, cancellable: bool) -> &mut Self
Declare a new thread.suspend intrinsic.
Sourcepub fn thread_yield(&mut self, cancellable: bool) -> &mut Self
pub fn thread_yield(&mut self, cancellable: bool) -> &mut Self
Declare a new thread.yield intrinsic.
Sourcepub fn thread_suspend_then_resume(&mut self, cancellable: bool) -> &mut Self
pub fn thread_suspend_then_resume(&mut self, cancellable: bool) -> &mut Self
Declare a new thread.suspend-then-resume intrinsic.
Sourcepub fn thread_yield_then_resume(&mut self, cancellable: bool) -> &mut Self
pub fn thread_yield_then_resume(&mut self, cancellable: bool) -> &mut Self
Declare a new thread.yield-then-resume intrinsic.
Sourcepub fn thread_suspend_then_promote(&mut self, cancellable: bool) -> &mut Self
pub fn thread_suspend_then_promote(&mut self, cancellable: bool) -> &mut Self
Declare a new thread.suspend-then-promote intrinsic.
Sourcepub fn thread_yield_then_promote(&mut self, cancellable: bool) -> &mut Self
pub fn thread_yield_then_promote(&mut self, cancellable: bool) -> &mut Self
Declare a new thread.yield-then-promote intrinsic.
Trait Implementations§
Source§impl Clone for CanonicalFunctionSection
impl Clone for CanonicalFunctionSection
Source§fn clone(&self) -> CanonicalFunctionSection
fn clone(&self) -> CanonicalFunctionSection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more