diff options
author | Aleksey Kladov <[email protected]> | 2020-06-25 16:14:11 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-25 16:14:11 +0100 |
commit | 379a096de9ad06c23347b76a54d9cc22aee80f6a (patch) | |
tree | 427fd07eb770b627cfc5d7376ed3746632509650 /crates/vfs-notify/src | |
parent | dd20c2ec5bc0c5ac02149479c2b5f3746f3df505 (diff) |
Refactor main_loop
Diffstat (limited to 'crates/vfs-notify/src')
-rw-r--r-- | crates/vfs-notify/src/lib.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs index 68fdb8cb0..25ba8d798 100644 --- a/crates/vfs-notify/src/lib.rs +++ b/crates/vfs-notify/src/lib.rs | |||
@@ -82,7 +82,12 @@ impl NotifyActor { | |||
82 | watcher_receiver, | 82 | watcher_receiver, |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | fn next_event(&self, receiver: &Receiver<Message>) -> Option<Event> { | |
86 | select! { | ||
87 | recv(receiver) -> it => it.ok().map(Event::Message), | ||
88 | recv(&self.watcher_receiver) -> it => Some(Event::NotifyEvent(it.unwrap())), | ||
89 | } | ||
90 | } | ||
86 | fn run(mut self, inbox: Receiver<Message>) { | 91 | fn run(mut self, inbox: Receiver<Message>) { |
87 | while let Some(event) = self.next_event(&inbox) { | 92 | while let Some(event) = self.next_event(&inbox) { |
88 | log::debug!("vfs-notify event: {:?}", event); | 93 | log::debug!("vfs-notify event: {:?}", event); |
@@ -154,12 +159,6 @@ impl NotifyActor { | |||
154 | } | 159 | } |
155 | } | 160 | } |
156 | } | 161 | } |
157 | fn next_event(&self, receiver: &Receiver<Message>) -> Option<Event> { | ||
158 | select! { | ||
159 | recv(receiver) -> it => it.ok().map(Event::Message), | ||
160 | recv(&self.watcher_receiver) -> it => Some(Event::NotifyEvent(it.unwrap())), | ||
161 | } | ||
162 | } | ||
163 | fn load_entry( | 162 | fn load_entry( |
164 | &mut self, | 163 | &mut self, |
165 | entry: loader::Entry, | 164 | entry: loader::Entry, |