Trait VMComponentAsyncStore

Source
pub trait VMComponentAsyncStore {
    // Required methods
    unsafe fn prepare_call(
        &mut self,
        instance: Instance,
        memory: *mut VMMemoryDefinition,
        start: *mut VMFuncRef,
        return_: *mut VMFuncRef,
        caller_instance: RuntimeComponentInstanceIndex,
        callee_instance: RuntimeComponentInstanceIndex,
        task_return_type: TypeTupleIndex,
        string_encoding: u8,
        result_count: u32,
        storage: *mut ValRaw,
        storage_len: usize,
    ) -> Result<()>;
    unsafe fn sync_start(
        &mut self,
        instance: Instance,
        callback: *mut VMFuncRef,
        callee: *mut VMFuncRef,
        param_count: u32,
        storage: *mut MaybeUninit<ValRaw>,
        storage_len: usize,
    ) -> Result<()>;
    unsafe fn async_start(
        &mut self,
        instance: Instance,
        callback: *mut VMFuncRef,
        post_return: *mut VMFuncRef,
        callee: *mut VMFuncRef,
        param_count: u32,
        result_count: u32,
        flags: u32,
    ) -> Result<u32>;
    fn future_write(
        &mut self,
        instance: Instance,
        ty: TypeFutureTableIndex,
        options: OptionsIndex,
        future: u32,
        address: u32,
    ) -> Result<u32>;
    fn future_read(
        &mut self,
        instance: Instance,
        ty: TypeFutureTableIndex,
        options: OptionsIndex,
        future: u32,
        address: u32,
    ) -> Result<u32>;
    fn future_drop_writable(
        &mut self,
        instance: Instance,
        ty: TypeFutureTableIndex,
        writer: u32,
    ) -> Result<()>;
    fn stream_write(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        options: OptionsIndex,
        stream: u32,
        address: u32,
        count: u32,
    ) -> Result<u32>;
    fn stream_read(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        options: OptionsIndex,
        stream: u32,
        address: u32,
        count: u32,
    ) -> Result<u32>;
    fn flat_stream_write(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        options: OptionsIndex,
        payload_size: u32,
        payload_align: u32,
        stream: u32,
        address: u32,
        count: u32,
    ) -> Result<u32>;
    fn flat_stream_read(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        options: OptionsIndex,
        payload_size: u32,
        payload_align: u32,
        stream: u32,
        address: u32,
        count: u32,
    ) -> Result<u32>;
    fn stream_drop_writable(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        writer: u32,
    ) -> Result<()>;
    fn error_context_debug_message(
        &mut self,
        instance: Instance,
        ty: TypeComponentLocalErrorContextTableIndex,
        options: OptionsIndex,
        err_ctx_handle: u32,
        debug_msg_address: u32,
    ) -> Result<()>;
}
Available on crate features runtime and component-model and component-model-async only.
Expand description

Trait representing component model ABI async intrinsics and fused adapter helper functions.

SAFETY (callers): Most of the methods in this trait accept raw pointers, which must be valid for at least the duration of the call (and possibly for as long as the relevant guest task exists, in the case of *mut VMFuncRef pointers used for async calls).

Required Methods§

Source

unsafe fn prepare_call( &mut self, instance: Instance, memory: *mut VMMemoryDefinition, start: *mut VMFuncRef, return_: *mut VMFuncRef, caller_instance: RuntimeComponentInstanceIndex, callee_instance: RuntimeComponentInstanceIndex, task_return_type: TypeTupleIndex, string_encoding: u8, result_count: u32, storage: *mut ValRaw, storage_len: usize, ) -> Result<()>

A helper function for fused adapter modules involving calls where the one of the caller or callee is async.

This helper is not used when the caller and callee both use the sync ABI, only when at least one is async is this used.

Source

unsafe fn sync_start( &mut self, instance: Instance, callback: *mut VMFuncRef, callee: *mut VMFuncRef, param_count: u32, storage: *mut MaybeUninit<ValRaw>, storage_len: usize, ) -> Result<()>

A helper function for fused adapter modules involving calls where the caller is sync-lowered but the callee is async-lifted.

Source

unsafe fn async_start( &mut self, instance: Instance, callback: *mut VMFuncRef, post_return: *mut VMFuncRef, callee: *mut VMFuncRef, param_count: u32, result_count: u32, flags: u32, ) -> Result<u32>

A helper function for fused adapter modules involving calls where the caller is async-lowered.

Source

fn future_write( &mut self, instance: Instance, ty: TypeFutureTableIndex, options: OptionsIndex, future: u32, address: u32, ) -> Result<u32>

The future.write intrinsic.

Source

fn future_read( &mut self, instance: Instance, ty: TypeFutureTableIndex, options: OptionsIndex, future: u32, address: u32, ) -> Result<u32>

The future.read intrinsic.

Source

fn future_drop_writable( &mut self, instance: Instance, ty: TypeFutureTableIndex, writer: u32, ) -> Result<()>

The future.drop-writable intrinsic.

Source

fn stream_write( &mut self, instance: Instance, ty: TypeStreamTableIndex, options: OptionsIndex, stream: u32, address: u32, count: u32, ) -> Result<u32>

The stream.write intrinsic.

Source

fn stream_read( &mut self, instance: Instance, ty: TypeStreamTableIndex, options: OptionsIndex, stream: u32, address: u32, count: u32, ) -> Result<u32>

The stream.read intrinsic.

Source

fn flat_stream_write( &mut self, instance: Instance, ty: TypeStreamTableIndex, options: OptionsIndex, payload_size: u32, payload_align: u32, stream: u32, address: u32, count: u32, ) -> Result<u32>

The “fast-path” implementation of the stream.write intrinsic for “flat” (i.e. memcpy-able) payloads.

Source

fn flat_stream_read( &mut self, instance: Instance, ty: TypeStreamTableIndex, options: OptionsIndex, payload_size: u32, payload_align: u32, stream: u32, address: u32, count: u32, ) -> Result<u32>

The “fast-path” implementation of the stream.read intrinsic for “flat” (i.e. memcpy-able) payloads.

Source

fn stream_drop_writable( &mut self, instance: Instance, ty: TypeStreamTableIndex, writer: u32, ) -> Result<()>

The stream.drop-writable intrinsic.

Source

fn error_context_debug_message( &mut self, instance: Instance, ty: TypeComponentLocalErrorContextTableIndex, options: OptionsIndex, err_ctx_handle: u32, debug_msg_address: u32, ) -> Result<()>

The error-context.debug-message intrinsic.

Implementors§