diff options
author | Aleksey Kladov <[email protected]> | 2018-08-30 11:12:49 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-30 11:12:49 +0100 |
commit | c2c64145cb0487b20b79d4bf470cda7e39fcb236 (patch) | |
tree | 133c220acab90d756ed48cc1951ed3752026e297 /crates/libanalysis/src/symbol_index.rs | |
parent | 1f2fb4e27f8ba1cb7b1d96a332b7ffc2ee659921 (diff) |
move
Diffstat (limited to 'crates/libanalysis/src/symbol_index.rs')
-rw-r--r-- | crates/libanalysis/src/symbol_index.rs | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/crates/libanalysis/src/symbol_index.rs b/crates/libanalysis/src/symbol_index.rs index 73cbf5702..cb35ab1d1 100644 --- a/crates/libanalysis/src/symbol_index.rs +++ b/crates/libanalysis/src/symbol_index.rs | |||
@@ -4,6 +4,7 @@ use libsyntax2::{ | |||
4 | SyntaxKind::{self, *}, | 4 | SyntaxKind::{self, *}, |
5 | }; | 5 | }; |
6 | use fst::{self, IntoStreamer, Streamer}; | 6 | use fst::{self, IntoStreamer, Streamer}; |
7 | use Query; | ||
7 | 8 | ||
8 | #[derive(Debug)] | 9 | #[derive(Debug)] |
9 | pub(crate) struct FileSymbols { | 10 | pub(crate) struct FileSymbols { |
@@ -30,38 +31,7 @@ impl FileSymbols { | |||
30 | } | 31 | } |
31 | } | 32 | } |
32 | 33 | ||
33 | pub struct Query { | ||
34 | query: String, | ||
35 | lowercased: String, | ||
36 | only_types: bool, | ||
37 | exact: bool, | ||
38 | limit: usize, | ||
39 | } | ||
40 | |||
41 | impl Query { | 34 | impl Query { |
42 | pub fn new(query: String) -> Query { | ||
43 | let lowercased = query.to_lowercase(); | ||
44 | Query { | ||
45 | query, | ||
46 | lowercased, | ||
47 | only_types: false, | ||
48 | exact: false, | ||
49 | limit: usize::max_value() | ||
50 | } | ||
51 | } | ||
52 | |||
53 | pub fn only_types(&mut self) { | ||
54 | self.only_types = true; | ||
55 | } | ||
56 | |||
57 | pub fn exact(&mut self) { | ||
58 | self.exact = true; | ||
59 | } | ||
60 | |||
61 | pub fn limit(&mut self, limit: usize) { | ||
62 | self.limit = limit | ||
63 | } | ||
64 | |||
65 | pub(crate) fn process( | 35 | pub(crate) fn process( |
66 | &mut self, | 36 | &mut self, |
67 | file: &FileSymbols, | 37 | file: &FileSymbols, |