mirror of
https://github.com/timvisee/ffsend.git
synced 2025-10-06 02:29:57 +02:00
Complete upload progress bar implementation, simplify with arc/mutex
This commit is contained in:
parent
030454cc10
commit
b57e85a8ec
4 changed files with 29 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use ffsend_api::action::upload::Upload as ApiUpload;
|
||||
use ffsend_api::reqwest::Client;
|
||||
|
@ -34,7 +34,7 @@ impl<'a> Upload<'a> {
|
|||
let client = Client::new();
|
||||
|
||||
// Create a progress bar reporter
|
||||
let bar = Box::new(ProgressBar::new());
|
||||
let bar = Arc::new(Mutex::new(ProgressBar::new()));
|
||||
|
||||
// Execute an upload action
|
||||
// TODO: do not unwrap, but return an error
|
||||
|
|
|
@ -42,7 +42,6 @@ impl ProgressReporter for ProgressBar {
|
|||
fn finish(&mut self) {
|
||||
self.bar.as_mut()
|
||||
.expect("progress bar not yet instantiated")
|
||||
// TODO: print a proper message here
|
||||
.finish_print("DONE");
|
||||
.finish_print("File uploaded");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue