style: run cargo fmt
This commit is contained in:
parent
f45493737a
commit
2f057425c3
3 changed files with 63 additions and 42 deletions
14
src/utils.rs
14
src/utils.rs
|
|
@ -1,5 +1,5 @@
|
|||
use std::{error::Error, future::Future};
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use std::{error::Error, future::Future};
|
||||
|
||||
pub async fn with_spinner<F, Fut, T>(
|
||||
start_msg: &str,
|
||||
|
|
@ -19,7 +19,6 @@ where
|
|||
pb.finish_and_clear();
|
||||
if !finish_msg.is_empty() {
|
||||
println!("{} {}", dialoguer::console::style("✔").green(), finish_msg);
|
||||
|
||||
}
|
||||
|
||||
result
|
||||
|
|
@ -31,14 +30,15 @@ pub async fn with_progressbar<F, Fut, T>(
|
|||
len: u64,
|
||||
f: F,
|
||||
) -> Result<T, Box<dyn Error>>
|
||||
where
|
||||
where
|
||||
F: FnOnce(ProgressBar) -> Fut,
|
||||
Fut: Future<Output = Result<T, Box<dyn Error>>>
|
||||
Fut: Future<Output = Result<T, Box<dyn Error>>>,
|
||||
{
|
||||
let pb = ProgressBar::new(len);
|
||||
pb.set_style(ProgressStyle::default_bar().template(
|
||||
"{msg}\n{bar:40.green/white} {bytes}/{total_bytes} ({bytes_per_sec})",
|
||||
)?);
|
||||
pb.set_style(
|
||||
ProgressStyle::default_bar()
|
||||
.template("{msg}\n{bar:40.green/white} {bytes}/{total_bytes} ({bytes_per_sec})")?,
|
||||
);
|
||||
pb.set_message(start_msg.to_string());
|
||||
|
||||
let result = f(pb.clone()).await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue