Trait VMComponentAsyncStore

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<(), Error>;
    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<(), Error>;
    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, Error>;
    fn future_write(
        &mut self,
        instance: Instance,
        ty: TypeFutureTableIndex,
        options: OptionsIndex,
        future: u32,
        address: u32,
    ) -> Result<u32, Error>;
    fn future_read(
        &mut self,
        instance: Instance,
        ty: TypeFutureTableIndex,
        options: OptionsIndex,
        future: u32,
        address: u32,
    ) -> Result<u32, Error>;
    fn future_drop_writable(
        &mut self,
        instance: Instance,
        ty: TypeFutureTableIndex,
        writer: u32,
    ) -> Result<(), Error>;
    fn stream_write(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        options: OptionsIndex,
        stream: u32,
        address: u32,
        count: u32,
    ) -> Result<u32, Error>;
    fn stream_read(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        options: OptionsIndex,
        stream: u32,
        address: u32,
        count: u32,
    ) -> Result<u32, Error>;
    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, Error>;
    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, Error>;
    fn stream_drop_writable(
        &mut self,
        instance: Instance,
        ty: TypeStreamTableIndex,
        writer: u32,
    ) -> Result<(), Error>;
    fn error_context_debug_message(
        &mut self,
        instance: Instance,
        ty: TypeComponentLocalErrorContextTableIndex,
        options: OptionsIndex,
        err_ctx_handle: u32,
        debug_msg_address: u32,
    ) -> Result<(), Error>;
}
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§

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<(), Error>

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.

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<(), Error>

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

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, Error>

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

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

The future.write intrinsic.

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

The future.read intrinsic.

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

The future.drop-writable intrinsic.

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

The stream.write intrinsic.

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

The stream.read intrinsic.

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, Error>

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

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, Error>

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

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

The stream.drop-writable intrinsic.

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

The error-context.debug-message intrinsic.

Implementors§