Trait RpcChannelExt

Source
pub trait RpcChannelExt {
    // Required methods
    fn register_host_function<F, Params, Return>(
        &mut self,
        name: &str,
        function: F,
    ) -> Result<()>
       where F: Fn(Params) -> Result<Return> + Send + Sync + 'static,
             Params: DeserializeOwned + 'static,
             Return: Serialize + 'static;
    fn call_guest_function<Params, Return>(
        &self,
        function_name: &str,
        params: &Params,
    ) -> Result<Return>
       where Params: Serialize + ?Sized,
             Return: DeserializeOwned + 'static;
}
Expand description

Extension trait for type-safe RPC operations (generic, not dyn-compatible)

Required Methods§

Source

fn register_host_function<F, Params, Return>( &mut self, name: &str, function: F, ) -> Result<()>
where F: Fn(Params) -> Result<Return> + Send + Sync + 'static, Params: DeserializeOwned + 'static, Return: Serialize + 'static,

Register a host function that can be called from the guest

Source

fn call_guest_function<Params, Return>( &self, function_name: &str, params: &Params, ) -> Result<Return>
where Params: Serialize + ?Sized, Return: DeserializeOwned + 'static,

Call a function in the guest

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.

Implementors§

Source§

impl<T: RpcChannel> RpcChannelExt for T

Automatic implementation for all RPC channels