Skip to main content

WindowManager

Trait WindowManager 

Source
pub trait WindowManager: Send + Sync {
    // Required methods
    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;
}
Expand description

窗口管理器 trait,定义平台原语。 平台实现者实现各原语方法,PluginHandle 通过注入的 WindowManager 委托调用。

Required Methods§

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,

根据进程名激活已存在的窗口。 参数:process_name - 进程名(如 “chrome.exe”,含扩展名)。 返回:成功激活返回 Ok(true),未找到窗口返回 Ok(false),失败返回 HostApiError。

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,

根据窗口标题的部分内容激活已存在的窗口。 参数:title - 窗口标题的部分匹配文本(不区分大小写)。 返回:成功激活返回 Ok(true),未找到窗口返回 Ok(false),失败返回 HostApiError。

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 激活已存在的窗口。 参数:pid - 进程标识符。 返回:成功激活返回 Ok(true),未找到窗口返回 Ok(false),失败返回 HostApiError。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§