diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-07-18 12:06:49 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-07-18 12:06:49 -0400 |
commit | 743354da056c65c6ce0910394230270ef793d8cc (patch) | |
tree | 22795339118dfdf2e819a03fa3b8081d87226339 /src/context | |
parent | eb8b155329b2c2689cc5b854f0b87f4448485c66 (diff) |
asynchronize delete operation
Diffstat (limited to 'src/context')
-rw-r--r-- | src/context/local_state.rs | 8 | ||||
-rw-r--r-- | src/context/worker_context.rs | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/context/local_state.rs b/src/context/local_state.rs index 71ca8f4..049d90d 100644 --- a/src/context/local_state.rs +++ b/src/context/local_state.rs @@ -1,22 +1,22 @@ -use crate::io::FileOp; +use crate::io::FileOperation; use std::iter::Iterator; use std::path; pub struct LocalStateContext { pub paths: Vec<path::PathBuf>, - pub file_op: FileOp, + pub file_op: FileOperation, } impl LocalStateContext { pub fn new() -> Self { Self { paths: Vec::new(), - file_op: FileOp::Copy, + file_op: FileOperation::Copy, } } - pub fn set_file_op(&mut self, operation: FileOp) { + pub fn set_file_op(&mut self, operation: FileOperation) { self.file_op = operation; } diff --git a/src/context/worker_context.rs b/src/context/worker_context.rs index fdd76fa..5bdf055 100644 --- a/src/context/worker_context.rs +++ b/src/context/worker_context.rs @@ -4,7 +4,7 @@ use std::sync::mpsc; use std::thread; use crate::event::AppEvent; -use crate::io::{IoWorkerObserver, IoWorkerProgress, IoWorkerThread}; +use crate::io::{FileOperationProgress, IoWorkerObserver, IoWorkerThread}; pub struct WorkerContext { // forks of applications @@ -49,7 +49,7 @@ impl WorkerContext { self.worker.as_ref() } - pub fn set_progress(&mut self, res: IoWorkerProgress) { + pub fn set_progress(&mut self, res: FileOperationProgress) { if let Some(s) = self.worker.as_mut() { s.set_progress(res); } @@ -77,7 +77,7 @@ impl WorkerContext { let worker_handle = thread::spawn(move || worker.start(wtx)); // relay worker info to event loop while let Ok(progress) = wrx.recv() { - let _ = tx.send(AppEvent::IoWorkerProgress(progress)); + let _ = tx.send(AppEvent::FileOperationProgress(progress)); } let result = worker_handle.join(); |