diff --git a/src/app.rs b/src/app.rs index c0150de..3128b32 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,5 +1,5 @@ use crossbeam::{ - channel::{unbounded, Receiver, Sender}, + channel::{unbounded, Receiver}, select, }; use std::path::PathBuf; @@ -29,9 +29,9 @@ pub struct App { job_list_state: ListState, job_stdout: Option, job_stdout_offset: u16, - job_watcher: JobWatcherHandle, + _job_watcher: JobWatcherHandle, job_stdout_watcher: FileWatcherHandle, - sender: Sender, + // sender: Sender, receiver: Receiver, input_receiver: Receiver>, } @@ -61,12 +61,12 @@ impl App { Self { focus: Focus::Jobs, jobs: Vec::new(), - job_watcher: JobWatcherHandle::new(sender.clone(), Duration::from_secs(2)), + _job_watcher: JobWatcherHandle::new(sender.clone(), Duration::from_secs(2)), job_list_state: ListState::default(), job_stdout: None, job_stdout_offset: 0, job_stdout_watcher: FileWatcherHandle::new(sender.clone()), - sender: sender, + // sender, receiver: receiver, input_receiver: input_receiver, } diff --git a/src/file_watcher.rs b/src/file_watcher.rs index fe0fec9..e510410 100644 --- a/src/file_watcher.rs +++ b/src/file_watcher.rs @@ -55,14 +55,14 @@ impl FileWatcher { }) .unwrap(); - let (mut content_sender, mut content_receiver) = unbounded::>(); + let (mut _content_sender, mut _content_receiver) = unbounded::>(); let (mut _watch_sender, mut _watch_receiver) = unbounded::<()>(); loop { select! { recv(self.receiver) -> msg => { match msg.unwrap() { FileWatcherMessage::FilePath(file_path) => { - (content_sender, content_receiver) = unbounded(); + (_content_sender, _content_receiver) = unbounded(); (_watch_sender, _watch_receiver) = unbounded::<()>(); if let Some(p) = &self.file_path { @@ -76,7 +76,7 @@ impl FileWatcher { Ok(_) => { self.file_path = Some(p); let p = self.file_path.clone(); - thread::spawn(move || FileReader::new(content_sender, _watch_receiver, p).run()); + thread::spawn(move || FileReader::new(_content_sender, _watch_receiver, p).run()); }, Err(e) => self.app.send(AppMessage::JobStdout(Some(format!("Failed to watch {:?}: {}", p, e)))).unwrap() }; @@ -85,7 +85,7 @@ impl FileWatcher { } } recv(watch_receiver) -> _ => { _watch_sender.send(()).unwrap(); } - recv(content_receiver) -> msg => { + recv(_content_receiver) -> msg => { self.app.send(AppMessage::JobStdout(msg.unwrap())).unwrap(); } }