Skip to content

Commit 381b651

Browse files
committed
refactor(download): use DownloadCallBack in download_with_backend()
1 parent cd06f34 commit 381b651

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

download/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ pub enum Event<'a> {
3535
DownloadDataReceived(&'a [u8]),
3636
}
3737

38+
type DownloadCallback<'a> = &'a dyn Fn(Event<'_>) -> Result<()>;
39+
3840
fn download_with_backend(
3941
backend: Backend,
4042
url: &Url,
4143
resume_from: u64,
42-
callback: &dyn Fn(Event<'_>) -> Result<()>,
44+
callback: DownloadCallback<'_>,
4345
) -> Result<()> {
4446
match backend {
4547
Backend::Curl => curl::download(url, resume_from, callback),
4648
Backend::Reqwest(tls) => reqwest_be::download(url, resume_from, callback, tls),
4749
}
4850
}
4951

50-
type DownloadCallback<'a> = &'a dyn Fn(Event<'_>) -> Result<()>;
51-
5252
pub fn download_to_path_with_backend(
5353
backend: Backend,
5454
url: &Url,

0 commit comments

Comments
 (0)