Skip to main content

SystemParameterProvider

Trait SystemParameterProvider 

Source
pub trait SystemParameterProvider: Send + Sync {
    // Required method
    fn get_value<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

系统参数提供者 trait

设计原则:

  • 每个 Provider 负责获取一种系统参数
  • 通过依赖注入到 HostApi,便于测试和跨平台实现
  • 异步接口,支持需要 I/O 操作的参数获取

架构说明:

  • trait 定义在功能模块内,与 IconExtractor、ShellExecutor 等保持一致
  • 平台实现在 sdk/platform/windows/parameter_providers.rs

Required Methods§

Source

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

获取参数值

返回:参数值的字符串表示,失败返回 ProviderError

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§