pub trait VMComponentAsyncStore {
// Required methods
unsafe fn prepare_call(
&mut self,
instance: Instance,
memory: *mut VMMemoryDefinition,
start: NonNull<VMFuncRef>,
return_: NonNull<VMFuncRef>,
caller_instance: RuntimeComponentInstanceIndex,
callee_instance: RuntimeComponentInstanceIndex,
task_return_type: TypeTupleIndex,
callee_async: bool,
string_encoding: StringEncoding,
result_count: u32,
storage: *mut ValRaw,
storage_len: usize,
) -> Result<()>;
unsafe fn start_call(
&mut self,
instance: Instance,
callback: *mut VMFuncRef,
post_return: *mut VMFuncRef,
callee: NonNull<VMFuncRef>,
param_count: u32,
result_count: u32,
flags: u32,
storage: *mut MaybeUninit<ValRaw>,
storage_len: usize,
) -> Result<()>;
fn future_write(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeFutureTableIndex,
options: OptionsIndex,
future: u32,
address: u32,
) -> Result<u32>;
fn future_read(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
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,
caller: RuntimeComponentInstanceIndex,
ty: TypeStreamTableIndex,
options: OptionsIndex,
stream: u32,
address: u32,
count: u32,
) -> Result<u32>;
fn stream_read(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeStreamTableIndex,
options: OptionsIndex,
stream: u32,
address: u32,
count: u32,
) -> Result<u32>;
fn flat_stream_write(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
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,
caller: RuntimeComponentInstanceIndex,
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<()>;
fn thread_new_indirect(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
func_ty_idx: ModuleInternedTypeIndex,
start_func_table_idx: RuntimeTableIndex,
start_func_idx: u32,
context: i32,
) -> Result<u32>;
}component-model-async and component-model and runtime 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§
Sourceunsafe fn prepare_call(
&mut self,
instance: Instance,
memory: *mut VMMemoryDefinition,
start: NonNull<VMFuncRef>,
return_: NonNull<VMFuncRef>,
caller_instance: RuntimeComponentInstanceIndex,
callee_instance: RuntimeComponentInstanceIndex,
task_return_type: TypeTupleIndex,
callee_async: bool,
string_encoding: StringEncoding,
result_count: u32,
storage: *mut ValRaw,
storage_len: usize,
) -> Result<()>
unsafe fn prepare_call( &mut self, instance: Instance, memory: *mut VMMemoryDefinition, start: NonNull<VMFuncRef>, return_: NonNull<VMFuncRef>, caller_instance: RuntimeComponentInstanceIndex, callee_instance: RuntimeComponentInstanceIndex, task_return_type: TypeTupleIndex, callee_async: bool, string_encoding: StringEncoding, 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.
Sourceunsafe fn start_call(
&mut self,
instance: Instance,
callback: *mut VMFuncRef,
post_return: *mut VMFuncRef,
callee: NonNull<VMFuncRef>,
param_count: u32,
result_count: u32,
flags: u32,
storage: *mut MaybeUninit<ValRaw>,
storage_len: usize,
) -> Result<()>
unsafe fn start_call( &mut self, instance: Instance, callback: *mut VMFuncRef, post_return: *mut VMFuncRef, callee: NonNull<VMFuncRef>, param_count: u32, result_count: u32, flags: u32, storage: *mut MaybeUninit<ValRaw>, storage_len: usize, ) -> Result<()>
A helper function for fused adapter modules to start a call previously
set up with prepare_call.
Sourcefn future_write(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeFutureTableIndex,
options: OptionsIndex,
future: u32,
address: u32,
) -> Result<u32>
fn future_write( &mut self, instance: Instance, caller: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, options: OptionsIndex, future: u32, address: u32, ) -> Result<u32>
The future.write intrinsic.
Sourcefn future_read(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeFutureTableIndex,
options: OptionsIndex,
future: u32,
address: u32,
) -> Result<u32>
fn future_read( &mut self, instance: Instance, caller: RuntimeComponentInstanceIndex, ty: TypeFutureTableIndex, options: OptionsIndex, future: u32, address: u32, ) -> Result<u32>
The future.read intrinsic.
Sourcefn future_drop_writable(
&mut self,
instance: Instance,
ty: TypeFutureTableIndex,
writer: u32,
) -> Result<()>
fn future_drop_writable( &mut self, instance: Instance, ty: TypeFutureTableIndex, writer: u32, ) -> Result<()>
The future.drop-writable intrinsic.
Sourcefn stream_write(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeStreamTableIndex,
options: OptionsIndex,
stream: u32,
address: u32,
count: u32,
) -> Result<u32>
fn stream_write( &mut self, instance: Instance, caller: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, options: OptionsIndex, stream: u32, address: u32, count: u32, ) -> Result<u32>
The stream.write intrinsic.
Sourcefn stream_read(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeStreamTableIndex,
options: OptionsIndex,
stream: u32,
address: u32,
count: u32,
) -> Result<u32>
fn stream_read( &mut self, instance: Instance, caller: RuntimeComponentInstanceIndex, ty: TypeStreamTableIndex, options: OptionsIndex, stream: u32, address: u32, count: u32, ) -> Result<u32>
The stream.read intrinsic.
Sourcefn flat_stream_write(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
ty: TypeStreamTableIndex,
options: OptionsIndex,
payload_size: u32,
payload_align: u32,
stream: u32,
address: u32,
count: u32,
) -> Result<u32>
fn flat_stream_write( &mut self, instance: Instance, caller: RuntimeComponentInstanceIndex, 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.
Sourcefn flat_stream_read(
&mut self,
instance: Instance,
caller: RuntimeComponentInstanceIndex,
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, caller: RuntimeComponentInstanceIndex, 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.
Sourcefn stream_drop_writable(
&mut self,
instance: Instance,
ty: TypeStreamTableIndex,
writer: u32,
) -> Result<()>
fn stream_drop_writable( &mut self, instance: Instance, ty: TypeStreamTableIndex, writer: u32, ) -> Result<()>
The stream.drop-writable intrinsic.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".