NetworkEventProcessor

Trait NetworkEventProcessor 

Source
pub trait NetworkEventProcessor: Send + Sync {
    // Required methods
    fn process_network_available<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn process_network_lost<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn process_network_type_changed<'life0, 'async_trait>(
        &'life0 self,
        is_wifi: bool,
        is_cellular: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

网络事件处理器 Trait

定义网络事件的处理逻辑,可由用户自定义实现

Required Methods§

Source

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

处理网络可用事件

§Returns
  • Ok(()): 处理成功
  • Err(String): 处理失败,包含错误信息
Source

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

处理网络丢失事件

§Returns
  • Ok(()): 处理成功
  • Err(String): 处理失败,包含错误信息
Source

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

处理网络类型变化事件

§Returns
  • Ok(()): 处理成功
  • Err(String): 处理失败,包含错误信息

Implementors§