pub trait ProgressCallback: Send + Sync {
// Required methods
fn on_file_start<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
file_size: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_file_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
downloaded: u64,
total: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_file_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn on_file_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
进度回调 trait
Required Methods§
Sourcefn on_file_start<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
file_size: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_file_start<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
file_size: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
当文件下载开始时调用
Sourcefn on_file_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
downloaded: u64,
total: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_file_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
file_name: &'life1 str,
downloaded: u64,
total: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
当文件下载进度更新时调用