aboutsummaryrefslogtreecommitdiff
path: root/crates/server/src/main_loop/subscriptions.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-30 14:27:09 +0100
committerAleksey Kladov <[email protected]>2018-08-30 14:27:09 +0100
commit9fcebbc51284408203c05219a0ee92519f51ea74 (patch)
tree5fd3f53769e3fe5b8f6a0d2a5eaa86167b7a3b10 /crates/server/src/main_loop/subscriptions.rs
parent7570d85869da7e2d35958047f8d1a90e3b6e2212 (diff)
subscriptions
Diffstat (limited to 'crates/server/src/main_loop/subscriptions.rs')
-rw-r--r--crates/server/src/main_loop/subscriptions.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/server/src/main_loop/subscriptions.rs b/crates/server/src/main_loop/subscriptions.rs
new file mode 100644
index 000000000..963096aef
--- /dev/null
+++ b/crates/server/src/main_loop/subscriptions.rs
@@ -0,0 +1,21 @@
1use std::collections::HashSet;
2use libanalysis::FileId;
3
4pub struct Subscriptions {
5 subs: HashSet<FileId>,
6}
7
8impl Subscriptions {
9 pub fn new() -> Subscriptions {
10 Subscriptions { subs: HashSet::new() }
11 }
12 pub fn add_sub(&mut self, file_id: FileId) {
13 self.subs.insert(file_id);
14 }
15 pub fn remove_sub(&mut self, file_id: FileId) {
16 self.subs.remove(&file_id);
17 }
18 pub fn subscriptions(&self) -> Vec<FileId> {
19 self.subs.iter().cloned().collect()
20 }
21}