HostWasmRpc

Trait HostWasmRpc 

Source
pub trait HostWasmRpc: Sized + Send {
    // Required methods
    fn new(
        &mut self,
        agent_id: AgentId,
    ) -> impl Future<Output = Result<Resource<WasmRpc>>> + Send;
    fn invoke_and_await(
        &mut self,
        self_: Resource<WasmRpc>,
        function_name: String,
        function_params: Vec<WitValue>,
    ) -> impl Future<Output = Result<Result<WitValue, RpcError>>> + Send;
    fn invoke(
        &mut self,
        self_: Resource<WasmRpc>,
        function_name: String,
        function_params: Vec<WitValue>,
    ) -> impl Future<Output = Result<Result<(), RpcError>>> + Send;
    fn async_invoke_and_await(
        &mut self,
        self_: Resource<WasmRpc>,
        function_name: String,
        function_params: Vec<WitValue>,
    ) -> impl Future<Output = Result<Resource<FutureInvokeResult>>> + Send;
    fn schedule_invocation(
        &mut self,
        self_: Resource<WasmRpc>,
        scheduled_time: Datetime,
        function_name: String,
        function_params: Vec<WitValue>,
    ) -> impl Future<Output = Result<()>> + Send;
    fn schedule_cancelable_invocation(
        &mut self,
        self_: Resource<WasmRpc>,
        scheduled_time: Datetime,
        function_name: String,
        function_params: Vec<WitValue>,
    ) -> impl Future<Output = Result<Resource<CancellationToken>>> + Send;
    fn drop(
        &mut self,
        rep: Resource<WasmRpc>,
    ) -> impl Future<Output = Result<()>> + Send;
}

Required Methods§

Source

fn new( &mut self, agent_id: AgentId, ) -> impl Future<Output = Result<Resource<WasmRpc>>> + Send

Constructs the RPC client connecting to the given target agent

Source

fn invoke_and_await( &mut self, self_: Resource<WasmRpc>, function_name: String, function_params: Vec<WitValue>, ) -> impl Future<Output = Result<Result<WitValue, RpcError>>> + Send

Invokes a remote function with the given parameters, and awaits the result

Source

fn invoke( &mut self, self_: Resource<WasmRpc>, function_name: String, function_params: Vec<WitValue>, ) -> impl Future<Output = Result<Result<(), RpcError>>> + Send

Triggers the invocation of a remote function with the given parameters, and returns immediately.

Source

fn async_invoke_and_await( &mut self, self_: Resource<WasmRpc>, function_name: String, function_params: Vec<WitValue>, ) -> impl Future<Output = Result<Resource<FutureInvokeResult>>> + Send

Invokes a remote function with the given parameters, and returns a future-invoke-result value which can be polled for the result.

With this function it is possible to call multiple (different) agents simultaneously.

Source

fn schedule_invocation( &mut self, self_: Resource<WasmRpc>, scheduled_time: Datetime, function_name: String, function_params: Vec<WitValue>, ) -> impl Future<Output = Result<()>> + Send

Schedule invocation for later

Source

fn schedule_cancelable_invocation( &mut self, self_: Resource<WasmRpc>, scheduled_time: Datetime, function_name: String, function_params: Vec<WitValue>, ) -> impl Future<Output = Result<Resource<CancellationToken>>> + Send

Schedule invocation for later. Call cancel on the returned resource to cancel the invocation before the scheduled time.

Source

fn drop( &mut self, rep: Resource<WasmRpc>, ) -> impl Future<Output = Result<()>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<_T: HostWasmRpc + ?Sized + Send> HostWasmRpc for &mut _T

Source§

async fn new(&mut self, agent_id: AgentId) -> Result<Resource<WasmRpc>>

Constructs the RPC client connecting to the given target agent

Source§

async fn invoke_and_await( &mut self, self_: Resource<WasmRpc>, function_name: String, function_params: Vec<WitValue>, ) -> Result<Result<WitValue, RpcError>>

Invokes a remote function with the given parameters, and awaits the result

Source§

async fn invoke( &mut self, self_: Resource<WasmRpc>, function_name: String, function_params: Vec<WitValue>, ) -> Result<Result<(), RpcError>>

Triggers the invocation of a remote function with the given parameters, and returns immediately.

Source§

async fn async_invoke_and_await( &mut self, self_: Resource<WasmRpc>, function_name: String, function_params: Vec<WitValue>, ) -> Result<Resource<FutureInvokeResult>>

Invokes a remote function with the given parameters, and returns a future-invoke-result value which can be polled for the result.

With this function it is possible to call multiple (different) agents simultaneously.

Source§

async fn schedule_invocation( &mut self, self_: Resource<WasmRpc>, scheduled_time: Datetime, function_name: String, function_params: Vec<WitValue>, ) -> Result<()>

Schedule invocation for later

Source§

async fn schedule_cancelable_invocation( &mut self, self_: Resource<WasmRpc>, scheduled_time: Datetime, function_name: String, function_params: Vec<WitValue>, ) -> Result<Resource<CancellationToken>>

Schedule invocation for later. Call cancel on the returned resource to cancel the invocation before the scheduled time.

Source§

async fn drop(&mut self, rep: Resource<WasmRpc>) -> Result<()>

Implementors§