diff options
Diffstat (limited to 'crates/vfs-notify/src/lib.rs')
-rw-r--r-- | crates/vfs-notify/src/lib.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs index a2f4e0c5b..282cf0358 100644 --- a/crates/vfs-notify/src/lib.rs +++ b/crates/vfs-notify/src/lib.rs | |||
@@ -20,7 +20,7 @@ use walkdir::WalkDir; | |||
20 | use crate::include::Include; | 20 | use crate::include::Include; |
21 | 21 | ||
22 | #[derive(Debug)] | 22 | #[derive(Debug)] |
23 | pub struct LoaderHandle { | 23 | pub struct NotifyHandle { |
24 | // Relative order of fields below is significant. | 24 | // Relative order of fields below is significant. |
25 | sender: crossbeam_channel::Sender<Message>, | 25 | sender: crossbeam_channel::Sender<Message>, |
26 | _thread: jod_thread::JoinHandle, | 26 | _thread: jod_thread::JoinHandle, |
@@ -32,12 +32,12 @@ enum Message { | |||
32 | Invalidate(AbsPathBuf), | 32 | Invalidate(AbsPathBuf), |
33 | } | 33 | } |
34 | 34 | ||
35 | impl loader::Handle for LoaderHandle { | 35 | impl loader::Handle for NotifyHandle { |
36 | fn spawn(sender: loader::Sender) -> LoaderHandle { | 36 | fn spawn(sender: loader::Sender) -> NotifyHandle { |
37 | let actor = LoaderActor::new(sender); | 37 | let actor = NotifyActor::new(sender); |
38 | let (sender, receiver) = unbounded::<Message>(); | 38 | let (sender, receiver) = unbounded::<Message>(); |
39 | let thread = jod_thread::spawn(move || actor.run(receiver)); | 39 | let thread = jod_thread::spawn(move || actor.run(receiver)); |
40 | LoaderHandle { sender, _thread: thread } | 40 | NotifyHandle { sender, _thread: thread } |
41 | } | 41 | } |
42 | fn set_config(&mut self, config: loader::Config) { | 42 | fn set_config(&mut self, config: loader::Config) { |
43 | self.sender.send(Message::Config(config)).unwrap() | 43 | self.sender.send(Message::Config(config)).unwrap() |
@@ -52,10 +52,10 @@ impl loader::Handle for LoaderHandle { | |||
52 | 52 | ||
53 | type NotifyEvent = notify::Result<notify::Event>; | 53 | type NotifyEvent = notify::Result<notify::Event>; |
54 | 54 | ||
55 | struct LoaderActor { | 55 | struct NotifyActor { |
56 | sender: loader::Sender, | ||
56 | config: Vec<(AbsPathBuf, Include, bool)>, | 57 | config: Vec<(AbsPathBuf, Include, bool)>, |
57 | watched_paths: FxHashSet<AbsPathBuf>, | 58 | watched_paths: FxHashSet<AbsPathBuf>, |
58 | sender: loader::Sender, | ||
59 | // Drop order of fields bellow is significant, | 59 | // Drop order of fields bellow is significant, |
60 | watcher: Option<RecommendedWatcher>, | 60 | watcher: Option<RecommendedWatcher>, |
61 | watcher_receiver: Receiver<NotifyEvent>, | 61 | watcher_receiver: Receiver<NotifyEvent>, |
@@ -67,19 +67,19 @@ enum Event { | |||
67 | NotifyEvent(NotifyEvent), | 67 | NotifyEvent(NotifyEvent), |
68 | } | 68 | } |
69 | 69 | ||
70 | impl LoaderActor { | 70 | impl NotifyActor { |
71 | fn new(sender: loader::Sender) -> LoaderActor { | 71 | fn new(sender: loader::Sender) -> NotifyActor { |
72 | let (watcher_sender, watcher_receiver) = unbounded(); | 72 | let (watcher_sender, watcher_receiver) = unbounded(); |
73 | let watcher = log_notify_error(Watcher::new_immediate(move |event| { | 73 | let watcher = log_notify_error(Watcher::new_immediate(move |event| { |
74 | watcher_sender.send(event).unwrap() | 74 | watcher_sender.send(event).unwrap() |
75 | })); | 75 | })); |
76 | 76 | ||
77 | LoaderActor { | 77 | NotifyActor { |
78 | watcher, | ||
79 | watcher_receiver, | ||
80 | watched_paths: FxHashSet::default(), | ||
81 | sender, | 78 | sender, |
82 | config: Vec::new(), | 79 | config: Vec::new(), |
80 | watched_paths: FxHashSet::default(), | ||
81 | watcher, | ||
82 | watcher_receiver, | ||
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||