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(&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.
Sourcepub fn task_backpressure(&mut self) -> &mut Self
pub fn task_backpressure(&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(&mut self, ty: u32) -> &mut Self
pub fn task_return(&mut self, ty: u32) -> &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_wait(&mut self, async_: bool, memory: u32) -> &mut Self
pub fn task_wait(&mut self, async_: bool, memory: u32) -> &mut Self
Defines a function which waits for at least one outstanding async task/stream/future to make progress, returning the first such event.
If async_
is true, the caller instance may be reentered.
Sourcepub fn task_poll(&mut self, async_: bool, memory: u32) -> &mut Self
pub fn task_poll(&mut self, async_: bool, memory: u32) -> &mut Self
Defines a function which checks whether any outstanding async
task/stream/future has made progress. Unlike task.wait
, this does not
block and may return nothing if no such event has occurred.
If async_
is true, the caller instance may be reentered.
Sourcepub fn task_yield(&mut self, async_: bool) -> &mut Self
pub fn task_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 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
.
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