Skip to main content

ShellExecutor

Trait ShellExecutor 

Source
pub trait ShellExecutor: Send + Sync {
    // Required methods
    fn shell_open<'life0, 'life1, 'async_trait>(
        &'life0 self,
        target: &'life1 OpenTarget,
    ) -> Pin<Box<dyn Future<Output = Result<(), HostApiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: '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;
}
Expand description

Shell 执行器 trait,定义平台原语。 平台实现者实现各原语方法,PluginHandle 通过注入的 ShellExecutor 委托调用。

Required Methods§

Source

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

使用系统默认方式打开目标(文件/网址/文件夹)。 参数:target - 打开目标枚举。 返回:成功返回 Ok(()),失败返回 HostApiError。

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,

在文件资源管理器中打开指定路径的父目录并选中该文件。 参数:path - 要打开所在位置的文件路径。 返回:成功返回 Ok(()),失败返回 HostApiError。

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,

以管理员权限启动程序。 参数:path - 要以管理员身份运行的程序路径。 返回:成功返回 Ok(()),失败返回 HostApiError。

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,

执行命令字符串(后台运行,无窗口)。 参数:command - 要执行的命令字符串。 返回:成功返回 Ok(()),失败返回 HostApiError。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§