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_drop_async(&mut self, ty_index: u32) -> &mut Self
pub fn resource_drop_async(&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_set(&mut self) -> &mut Self
pub fn backpressure_set(&mut self) -> &mut Self
Defines a function which tells the host to enable or disable backpressure for the caller’s instance. When backpressure is enabled, the host must not start any new calls to that instance until backpressure is disabled.
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, i: u32) -> &mut Self
pub fn context_get(&mut self, i: u32) -> &mut Self
Defines a new context.get intrinsic of the ith slot.
Sourcepub fn context_set(&mut self, i: u32) -> &mut Self
pub fn context_set(&mut self, i: u32) -> &mut Self
Defines a new context.set intrinsic of the ith slot.
Sourcepub fn yield_(&mut self, async_: bool) -> &mut Self
pub fn yield_(&mut self, async_: bool) -> &mut Self
Defines a function which yields control to the host so that other tasks are able to make progress, if any.
If async_ is true, the caller instance may be reentered.
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_close_readable(&mut self, ty: u32) -> &mut Self
pub fn stream_close_readable(&mut self, ty: u32) -> &mut Self
Defines a function to close the readable end of a stream of the
specified type.
Sourcepub fn stream_close_writable(&mut self, ty: u32) -> &mut Self
pub fn stream_close_writable(&mut self, ty: u32) -> &mut Self
Defines a function to close 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_close_readable(&mut self, ty: u32) -> &mut Self
pub fn future_close_readable(&mut self, ty: u32) -> &mut Self
Defines a function to close the readable end of a future of the
specified type.
Sourcepub fn future_close_writable(&mut self, ty: u32) -> &mut Self
pub fn future_close_writable(&mut self, ty: u32) -> &mut Self
Defines a function to close 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.
Trait Implementations§
Source§impl Clone for CanonicalFunctionSection
impl Clone for CanonicalFunctionSection
Source§fn clone(&self) -> CanonicalFunctionSection
fn clone(&self) -> CanonicalFunctionSection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more