blob: c31b94d4716e7284e85078a9fe09f69aa163df0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
use std::path;
use std::thread;
#[derive(Debug)]
pub struct IOWorkerObserver {
pub handle: thread::JoinHandle<()>,
msg: Option<String>,
src: path::PathBuf,
dest: path::PathBuf,
}
impl IOWorkerObserver {
pub fn new(handle: thread::JoinHandle<()>, src: path::PathBuf, dest: path::PathBuf) -> Self {
Self {
handle,
src,
dest,
msg: None,
}
}
pub fn join(self) {
self.handle.join();
}
pub fn set_msg(&mut self, msg: String) {
self.msg = Some(msg)
}
pub fn get_msg(&self) -> Option<&String> {
self.msg.as_ref()
}
pub fn clear_msg(&mut self) {
self.msg = None
}
pub fn get_src_path(&self) -> &path::Path {
self.src.as_path()
}
pub fn get_dest_path(&self) -> &path::Path {
self.dest.as_path()
}
}
|