Skip to main content

PluginHost

Trait PluginHost 

Source
pub trait PluginHost: Send + Sync {
Show 46 methods // Required methods fn get_icon<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 IconRequest, level: CacheLevel, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_icon_or_default<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 IconRequest, level: CacheLevel, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_icon_and_update_cache<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 IconRequest, level: CacheLevel, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn override_icon_cache<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, original_request: &'life1 IconRequest, custom_icon_path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn shell_open<'life0, 'async_trait>( &'life0 self, target: OpenTarget, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn shell_open_folder<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn shell_execute_elevation<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn shell_execute_command<'life0, 'life1, 'async_trait>( &'life0 self, command: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn activate_window_by_process<'life0, 'life1, 'async_trait>( &'life0 self, process_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn activate_window_by_title<'life0, 'life1, 'async_trait>( &'life0 self, title: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn activate_window_by_pid<'life0, 'async_trait>( &'life0 self, pid: u32, ) -> Pin<Box<dyn Future<Output = Result<bool, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn resolve_path(&self, path: KnownPath) -> Result<String, HostApiError>; fn set_clipboard_text(&self, text: &str) -> Result<(), HostApiError>; fn enumerate_apps<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<AppInfo>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn launch_app<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, app_id: &'life1 str, args: Option<&'life2 [String]>, ) -> Pin<Box<dyn Future<Output = Result<u32, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_app_icon_path(&self, name: &str) -> Option<String>; fn resolve_lnk_target(&self, lnk_path: &str) -> Option<String>; fn parse_localized_names_from_dir( &self, dir_path: &Path, ) -> HashMap<String, String>; fn get_theme(&self) -> Result<Theme, HostApiError>; fn get_system_theme(&self) -> Result<Theme, HostApiError>; fn model_list(&self) -> Vec<ModelInfo>; fn model_chat<'life0, 'async_trait>( &'life0 self, req: ModelChatRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelChatResponse, ModelError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn model_embedding<'life0, 'async_trait>( &'life0 self, req: ModelEmbeddingRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelEmbeddingResponse, ModelError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn model_similarity<'life0, 'async_trait>( &'life0 self, req: ModelSimilarityRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelSimilarityResponse, ModelError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn resolve_parameters<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, template: &'life1 str, user_args: &'life2 [String], snapshot: &'life3 ParameterSnapshot, ) -> Pin<Box<dyn Future<Output = Result<String, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn count_user_parameters(&self, template: &str) -> usize; fn has_system_parameters(&self, template: &str) -> bool; fn set_timeout<'life0, 'async_trait>( &'life0 self, delay: Duration, callback: TimerCallback, ) -> Pin<Box<dyn Future<Output = Result<TimerId, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_interval<'life0, 'async_trait>( &'life0 self, interval: Duration, callback: TimerCallback, ) -> Pin<Box<dyn Future<Output = Result<TimerId, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cancel_timer<'life0, 'async_trait>( &'life0 self, id: TimerId, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cancel_all_timers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn resource_upload<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, file_path: &'life3 str, max_size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<String, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn resource_put<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, data: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn resource_get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn resource_delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn resource_list<'life0, 'life1, 'async_trait>( &'life0 self, plugin_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn cache_put<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, key: &'life3 str, data: &'life4 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait; fn cache_get<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn cache_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn cache_cleanup<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, max_entries: usize, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn register_hotkey_callback( &self, plugin_id: &str, id: &str, filter: HotkeyEventFilter, callback: HotkeyCallback, ); fn unregister_hotkey_callback(&self, plugin_id: &str, id: &str); fn register_installation_callback( &self, plugin_id: &str, id: &str, callback: InstallationCallback, ); fn unregister_installation_callback(&self, plugin_id: &str, id: &str); fn register_focus_callback( &self, plugin_id: &str, id: &str, callback: FocusCallback, ); fn unregister_focus_callback(&self, plugin_id: &str, id: &str);
}
Expand description

宿主操作契约。实现方为宿主(真实 HostApi)或测试桩宿主。

Required Methods§

Source

fn get_icon<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 IconRequest, level: CacheLevel, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

根据图标请求提取图标数据,行为由缓存等级决定。 参数:request - 图标请求;level - 插件配置的缓存等级。 返回:WebP 格式的图标字节数据(回退路径可能为 PNG),失败返回 HostApiError。

Source

fn get_icon_or_default<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 IconRequest, level: CacheLevel, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

提取图标数据,失败时回退到默认图标(永不返回错误)。

Source

fn get_icon_and_update_cache<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 IconRequest, level: CacheLevel, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

强制从磁盘提取图标数据并根据缓存等级更新缓存(跳过缓存读取)。

Source

fn override_icon_cache<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, original_request: &'life1 IconRequest, custom_icon_path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

覆盖指定 IconRequest 的缓存图标为自定义图标文件。 参数:original_request - 需要覆盖图标的原始 IconRequest; custom_icon_path - 用户选择的自定义图标文件路径。

Source

fn shell_open<'life0, 'async_trait>( &'life0 self, target: OpenTarget, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

使用系统默认方式打开目标(文件/网址/文件夹)。

Source

fn shell_open_folder<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

在文件资源管理器中打开指定路径的父目录并选中该文件。

Source

fn shell_execute_elevation<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

以管理员权限启动程序。

Source

fn shell_execute_command<'life0, 'life1, 'async_trait>( &'life0 self, command: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

执行命令字符串(后台运行,无窗口)。

Source

fn activate_window_by_process<'life0, 'life1, 'async_trait>( &'life0 self, process_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

根据进程名(如 “chrome.exe”)激活已存在的窗口。 返回:成功激活返回 Ok(true),未找到窗口返回 Ok(false)。

Source

fn activate_window_by_title<'life0, 'life1, 'async_trait>( &'life0 self, title: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

根据窗口标题的部分内容激活已存在的窗口。

Source

fn activate_window_by_pid<'life0, 'async_trait>( &'life0 self, pid: u32, ) -> Pin<Box<dyn Future<Output = Result<bool, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

根据进程 PID 激活已存在的窗口。

Source

fn resolve_path(&self, path: KnownPath) -> Result<String, HostApiError>

根据已知路径类型解析实际文件系统路径。

Source

fn set_clipboard_text(&self, text: &str) -> Result<(), HostApiError>

将文本写入系统剪贴板。

Source

fn enumerate_apps<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<AppInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

枚举当前平台已安装的应用。

Source

fn launch_app<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, app_id: &'life1 str, args: Option<&'life2 [String]>, ) -> Pin<Box<dyn Future<Output = Result<u32, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

启动指定应用。返回:成功返回 Ok(pid)。

Source

fn get_app_icon_path(&self, name: &str) -> Option<String>

根据名称获取内置图标资源的文件系统路径,未注册则返回 None。

Source

fn resolve_lnk_target(&self, lnk_path: &str) -> Option<String>

解析 .lnk 快捷方式文件的目标路径,失败返回 None。

Source

fn parse_localized_names_from_dir( &self, dir_path: &Path, ) -> HashMap<String, String>

解析指定目录下的 desktop.ini 文件,提取 [LocalizedFileNames] 部分。

Source

fn get_theme(&self) -> Result<Theme, HostApiError>

查询宿主当前实际生效的界面主题。 显式 light/dark 配置直接返回;system 模式委托平台读取系统主题。

Source

fn get_system_theme(&self) -> Result<Theme, HostApiError>

查询系统主题(未应用宿主显式 light/dark 配置),供前端 system 模式跟随。

Source

fn model_list(&self) -> Vec<ModelInfo>

全网模型清单(聚合缓存,含所有已注册提供方)。

Source

fn model_chat<'life0, 'async_trait>( &'life0 self, req: ModelChatRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelChatResponse, ModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

按 model_id 调用文本生成。

Source

fn model_embedding<'life0, 'async_trait>( &'life0 self, req: ModelEmbeddingRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelEmbeddingResponse, ModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

按 model_id 调用文本向量化(task_type 必填,宿主对缺失/未知值返回 InvalidRequest)。

Source

fn model_similarity<'life0, 'async_trait>( &'life0 self, req: ModelSimilarityRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelSimilarityResponse, ModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

按 model_id 计算查询向量与多个目标向量的相似度。

Source

fn resolve_parameters<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, template: &'life1 str, user_args: &'life2 [String], snapshot: &'life3 ParameterSnapshot, ) -> Pin<Box<dyn Future<Output = Result<String, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

解析参数模板。返回:填充后的完整字符串。

Source

fn count_user_parameters(&self, template: &str) -> usize

统计模板中需要用户输入的参数数量。

Source

fn has_system_parameters(&self, template: &str) -> bool

检查模板是否包含系统参数。

Source

fn set_timeout<'life0, 'async_trait>( &'life0 self, delay: Duration, callback: TimerCallback, ) -> Pin<Box<dyn Future<Output = Result<TimerId, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

创建一个一次性定时器,在指定延迟后触发回调。

Source

fn set_interval<'life0, 'async_trait>( &'life0 self, interval: Duration, callback: TimerCallback, ) -> Pin<Box<dyn Future<Output = Result<TimerId, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

创建一个重复定时器,每隔指定间隔触发回调。

Source

fn cancel_timer<'life0, 'async_trait>( &'life0 self, id: TimerId, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

取消指定 ID 的定时器。

Source

fn cancel_all_timers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

取消所有定时器。

Source

fn resource_upload<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, file_path: &'life3 str, max_size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<String, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

上传资源文件到指定插件的资源空间。 参数:plugin_id - 插件 ID(决定存储命名空间)。

Source

fn resource_put<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, data: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

直接写入资源字节数据,无需本地路径。

Source

fn resource_get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

获取资源文件内容。

Source

fn resource_delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plugin_id: &'life1 str, resource_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

删除资源文件。

Source

fn resource_list<'life0, 'life1, 'async_trait>( &'life0 self, plugin_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

列出指定插件的所有资源。

Source

fn cache_put<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, key: &'life3 str, data: &'life4 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

写入插件本地缓存(可再生的本地数据,不经 StorageService,仅落在本地缓存目录)。

Source

fn cache_get<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

读取插件本地缓存;缓存不存在时返回 Ok(None)。

Source

fn cache_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

删除插件本地缓存条目;缓存不存在时视为成功。

Source

fn cache_cleanup<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plugin_id: &'life1 str, domain: &'life2 str, max_entries: usize, ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

容量控制:缓存域条目超过 max_entries 时按修改时间删除最旧条目。

Source

fn register_hotkey_callback( &self, plugin_id: &str, id: &str, filter: HotkeyEventFilter, callback: HotkeyCallback, )

注册按键事件回调。ID 自动前缀化为 “{plugin_id}:{id}”。

Source

fn unregister_hotkey_callback(&self, plugin_id: &str, id: &str)

注销按键事件回调。

Source

fn register_installation_callback( &self, plugin_id: &str, id: &str, callback: InstallationCallback, )

注册安装事件回调。ID 自动前缀化为 “{plugin_id}:{id}”。

Source

fn unregister_installation_callback(&self, plugin_id: &str, id: &str)

注销安装事件回调。

Source

fn register_focus_callback( &self, plugin_id: &str, id: &str, callback: FocusCallback, )

注册焦点事件回调。ID 自动前缀化为 “{plugin_id}:{id}”。

Source

fn unregister_focus_callback(&self, plugin_id: &str, id: &str)

注销焦点事件回调。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§