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 new() -> Self
Available on crate feature component-model only.
pub fn new() -> Self
component-model only.Construct a new component function section encoder.
Sourcepub fn len(&self) -> u32
Available on crate feature component-model only.
pub fn len(&self) -> u32
component-model only.The number of functions in the section.
Sourcepub fn is_empty(&self) -> bool
Available on crate feature component-model only.
pub fn is_empty(&self) -> bool
component-model only.Determines if the section is empty.
Sourcepub fn lift<O>(
&mut self,
core_func_index: u32,
type_index: u32,
options: O,
) -> &mut Self
Available on crate feature component-model only.
pub fn lift<O>( &mut self, core_func_index: u32, type_index: u32, options: O, ) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn lower<O>(&mut self, func_index: u32, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn resource_new(&mut self, ty_index: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn resource_drop(&mut self, ty_index: u32) -> &mut Self
component-model only.Defines a function which will drop the specified type of handle.
Sourcepub fn resource_drop_async(&mut self, ty_index: u32) -> &mut Self
Available on crate feature component-model only.
pub fn resource_drop_async(&mut self, ty_index: u32) -> &mut Self
component-model only.Defines a function which will drop the specified type of handle.
Sourcepub fn resource_rep(&mut self, ty_index: u32) -> &mut Self
Available on crate feature component-model only.
pub fn resource_rep(&mut self, ty_index: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn thread_spawn_ref(&mut self, ty_index: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn thread_spawn_indirect( &mut self, ty_index: u32, table_index: u32, ) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn thread_available_parallelism(&mut self) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn backpressure_set(&mut self) -> &mut Self
component-model only.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 backpressure_inc(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn backpressure_inc(&mut self) -> &mut Self
component-model only.Defines a function which tells the host to increment the backpressure counter.
Sourcepub fn backpressure_dec(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn backpressure_dec(&mut self) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn task_return<O>( &mut self, ty: Option<ComponentValType>, options: O, ) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn task_cancel(&mut self) -> &mut Self
component-model only.Defines a function to acknowledge cancellation of the current task.
Sourcepub fn context_get(&mut self, i: u32) -> &mut Self
Available on crate feature component-model only.
pub fn context_get(&mut self, i: u32) -> &mut Self
component-model only.Defines a new context.get intrinsic of the ith slot.
Sourcepub fn context_set(&mut self, i: u32) -> &mut Self
Available on crate feature component-model only.
pub fn context_set(&mut self, i: u32) -> &mut Self
component-model only.Defines a new context.set intrinsic of the ith slot.
Sourcepub fn thread_yield(&mut self, cancellable: bool) -> &mut Self
Available on crate feature component-model only.
pub fn thread_yield(&mut self, cancellable: bool) -> &mut Self
component-model only.Defines a function which yields control to the host so that other tasks are able to make progress, if any.
If cancellable is true, the caller instance may be reentered.
Sourcepub fn subtask_drop(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn subtask_drop(&mut self) -> &mut Self
component-model only.Defines a function to drop a specified task which has completed.
Sourcepub fn subtask_cancel(&mut self, async_: bool) -> &mut Self
Available on crate feature component-model only.
pub fn subtask_cancel(&mut self, async_: bool) -> &mut Self
component-model only.Defines a function to cancel an in-progress task.
Sourcepub fn stream_new(&mut self, ty: u32) -> &mut Self
Available on crate feature component-model only.
pub fn stream_new(&mut self, ty: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn stream_read<O>(&mut self, ty: u32, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn stream_write<O>(&mut self, ty: u32, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn stream_cancel_read(&mut self, ty: u32, async_: bool) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn stream_cancel_write(&mut self, ty: u32, async_: bool) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn stream_drop_readable(&mut self, ty: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn stream_drop_writable(&mut self, ty: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_new(&mut self, ty: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_read<O>(&mut self, ty: u32, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_write<O>(&mut self, ty: u32, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_cancel_read(&mut self, ty: u32, async_: bool) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_cancel_write(&mut self, ty: u32, async_: bool) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_drop_readable(&mut self, ty: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn future_drop_writable(&mut self, ty: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn error_context_new<O>(&mut self, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn error_context_debug_message<O>(&mut self, options: O) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn error_context_drop(&mut self) -> &mut Self
component-model only.Defines a function to drop a specified error-context.
Sourcepub fn waitable_set_new(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn waitable_set_new(&mut self) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn waitable_set_wait(&mut self, async_: bool, memory: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn waitable_set_poll(&mut self, async_: bool, memory: u32) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn waitable_set_drop(&mut self) -> &mut Self
component-model only.Declare a new waitable-set.drop intrinsic, used to dispose a
waitable-set pseudo-resource.
Sourcepub fn waitable_join(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn waitable_join(&mut self) -> &mut Self
component-model only.Declare a new waitable.join intrinsic, used to add an item to a
waitable-set.
Sourcepub fn thread_index(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn thread_index(&mut self) -> &mut Self
component-model only.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
Available on crate feature component-model only.
pub fn thread_new_indirect( &mut self, ty_index: u32, table_index: u32, ) -> &mut Self
component-model only.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_switch_to(&mut self, cancellable: bool) -> &mut Self
Available on crate feature component-model only.
pub fn thread_switch_to(&mut self, cancellable: bool) -> &mut Self
component-model only.Declare a new thread.switch-to intrinsic, used to switch execution to
another thread.
Sourcepub fn thread_suspend(&mut self, cancellable: bool) -> &mut Self
Available on crate feature component-model only.
pub fn thread_suspend(&mut self, cancellable: bool) -> &mut Self
component-model only.Declare a new thread.suspend intrinsic, used to suspend execution of
the current thread.
Sourcepub fn thread_resume_later(&mut self) -> &mut Self
Available on crate feature component-model only.
pub fn thread_resume_later(&mut self) -> &mut Self
component-model only.Declare a new thread.resume-later intrinsic, used to resume execution
of the given thread.
Sourcepub fn thread_yield_to(&mut self, cancellable: bool) -> &mut Self
Available on crate feature component-model only.
pub fn thread_yield_to(&mut self, cancellable: bool) -> &mut Self
component-model only.Declare a new thread.yield-to intrinsic, used to yield execution to
a given thread.
Trait Implementations§
Source§impl Clone for CanonicalFunctionSection
Available on crate feature component-model only.
impl Clone for CanonicalFunctionSection
component-model only.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 moreSource§impl ComponentSection for CanonicalFunctionSection
Available on crate feature component-model only.
impl ComponentSection for CanonicalFunctionSection
component-model only.Source§impl Debug for CanonicalFunctionSection
Available on crate feature component-model only.
impl Debug for CanonicalFunctionSection
component-model only.Source§impl Default for CanonicalFunctionSection
Available on crate feature component-model only.
impl Default for CanonicalFunctionSection
component-model only.