diff --git a/Cargo.lock b/Cargo.lock index a2b7579..e924c2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -211,7 +211,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "dfu-core" version = "0.6.0" -source = "git+https://github.com/sjoerdsimons/dfu-core?branch=async#cfac99c883d5a356cd85b876c0da32e0eec87c48" +source = "git+https://github.com/sjoerdsimons/dfu-core?branch=async#606af1cdc535afa25c425eb6a11b54d2a11a037c" dependencies = [ "bytes 1.8.0", "displaydoc", @@ -388,6 +388,7 @@ dependencies = [ "instant", "number_prefix", "portable-atomic", + "tokio", "unicode-width", ] diff --git a/Cargo.toml b/Cargo.toml index b7a54da..e06e321 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ readme = "README.md" [dependencies] dfu-core = { version = "0.6.0", features = ["async"] } futures = { version = "0.3.31", features = ["io-compat"] } -indicatif = "0.17.8" +indicatif = { version = "0.17.8", features = [ "tokio" ] } nusb = "0.1.10" thiserror = "1.0.65" tokio = { version = "1.41.0", features = ["full"] } diff --git a/examples/download.rs b/examples/download.rs index 1eaf127..154ec4c 100644 --- a/examples/download.rs +++ b/examples/download.rs @@ -102,20 +102,11 @@ pub async fn run(opts: Cli) -> anyhow::Result<()> { .progress_chars("#>-"), ); - device.with_progress({ - let bar = bar.clone(); - move |count| { - bar.inc(count as u64); - if bar.position() == file_size as u64 { - bar.finish(); - } - } - }); - if let Some(address) = override_address { device.override_address(address); } + let file = bar.wrap_async_read(file); let file = file.compat(); match device.download(file, file_size).await { Ok(_) => (),