pub trait HostCallHandler: Send + Sync {
// Required method
fn handle_host_call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, JsonRpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn attach_event_sink(&self, _sink: Arc<dyn PluginEventSink>) { ... }
fn detach_event_sink(&self) { ... }
}Expand description
Maps a host/* method name to the corresponding PluginHandle call. The actual PluginHandle type is provided by src-tauri, so this is a trait-based dispatch to avoid coupling plugin-host to src-tauri.
Required Methods§
Sourcefn handle_host_call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, JsonRpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_host_call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, JsonRpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a host/* RPC call. Returns Ok(serde_json::Value) on success.
Provided Methods§
Sourcefn attach_event_sink(&self, _sink: Arc<dyn PluginEventSink>)
fn attach_event_sink(&self, _sink: Arc<dyn PluginEventSink>)
注入宿主 → 插件的事件推送通道(重启时重新注入,覆盖旧通道)。 默认空实现:不推送事件的宿主可忽略。
Sourcefn detach_event_sink(&self)
fn detach_event_sink(&self)
通知宿主推送通道已失效,注销该插件的订阅回调并取消其定时器。 默认空实现。
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".