pub trait RpcChannel: Send + Sync {
// Required methods
fn register_host_function_json(
&mut self,
name: &str,
function: Box<dyn Fn(&str) -> Result<String> + Send + Sync + 'static>,
) -> Result<()>;
fn call_guest_function_json(
&self,
function_name: &str,
params_json: &str,
) -> Result<String>;
fn register_host_function_msgpack(
&mut self,
name: &str,
function: Box<dyn Fn(&[u8]) -> Result<Vec<u8>> + Send + Sync + 'static>,
) -> Result<()>;
fn call_guest_function_msgpack(
&self,
function_name: &str,
params_msgpack: &[u8],
) -> Result<Vec<u8>>;
}
Expand description
RPC mechanism between host and guest (dyn-compatible part)
Required Methods§
Sourcefn register_host_function_json(
&mut self,
name: &str,
function: Box<dyn Fn(&str) -> Result<String> + Send + Sync + 'static>,
) -> Result<()>
fn register_host_function_json( &mut self, name: &str, function: Box<dyn Fn(&str) -> Result<String> + Send + Sync + 'static>, ) -> Result<()>
Register a host function with JSON serialization
Sourcefn call_guest_function_json(
&self,
function_name: &str,
params_json: &str,
) -> Result<String>
fn call_guest_function_json( &self, function_name: &str, params_json: &str, ) -> Result<String>
Call a function in the guest with JSON serialization