diff options
Diffstat (limited to 'crates/ra_db/src/input.rs')
-rw-r--r-- | crates/ra_db/src/input.rs | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 2b761ea0c..b5d63e820 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -146,46 +146,31 @@ impl CrateGraph { | |||
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | salsa::query_group! { | 149 | #[salsa::query_group] |
150 | pub trait FilesDatabase: salsa::Database { | 150 | pub trait FilesDatabase: salsa::Database { |
151 | /// Text of the file. | 151 | /// Text of the file. |
152 | fn file_text(file_id: FileId) -> Arc<String> { | 152 | #[salsa::input] |
153 | type FileTextQuery; | 153 | fn file_text(&self, file_id: FileId) -> Arc<String>; |
154 | storage input; | 154 | /// Path to a file, relative to the root of its source root. |
155 | } | 155 | #[salsa::input] |
156 | /// Path to a file, relative to the root of its source root. | 156 | fn file_relative_path(&self, file_id: FileId) -> RelativePathBuf; |
157 | fn file_relative_path(file_id: FileId) -> RelativePathBuf { | 157 | /// Source root of the file. |
158 | type FileRelativePathQuery; | 158 | #[salsa::input] |
159 | storage input; | 159 | fn file_source_root(&self, file_id: FileId) -> SourceRootId; |
160 | } | 160 | /// Contents of the source root. |
161 | /// Source root of the file. | 161 | #[salsa::input] |
162 | fn file_source_root(file_id: FileId) -> SourceRootId { | 162 | fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>; |
163 | type FileSourceRootQuery; | 163 | /// The set of "local" (that is, from the current workspace) roots. |
164 | storage input; | 164 | /// Files in local roots are assumed to change frequently. |
165 | } | 165 | #[salsa::input] |
166 | /// Contents of the source root. | 166 | fn local_roots(&self) -> Arc<Vec<SourceRootId>>; |
167 | fn source_root(id: SourceRootId) -> Arc<SourceRoot> { | 167 | /// The set of roots for crates.io libraries. |
168 | type SourceRootQuery; | 168 | /// Files in libraries are assumed to never change. |
169 | storage input; | 169 | #[salsa::input] |
170 | } | 170 | fn library_roots(&self) -> Arc<Vec<SourceRootId>>; |
171 | /// The set of "local" (that is, from the current workspace) roots. | 171 | /// The crate graph. |
172 | /// Files in local roots are assumed to change frequently. | 172 | #[salsa::input] |
173 | fn local_roots() -> Arc<Vec<SourceRootId>> { | 173 | fn crate_graph(&self) -> Arc<CrateGraph>; |
174 | type LocalRootsQuery; | ||
175 | storage input; | ||
176 | } | ||
177 | /// The set of roots for crates.io libraries. | ||
178 | /// Files in libraries are assumed to never change. | ||
179 | fn library_roots() -> Arc<Vec<SourceRootId>> { | ||
180 | type LibraryRootsQuery; | ||
181 | storage input; | ||
182 | } | ||
183 | /// The crate graph. | ||
184 | fn crate_graph() -> Arc<CrateGraph> { | ||
185 | type CrateGraphQuery; | ||
186 | storage input; | ||
187 | } | ||
188 | } | ||
189 | } | 174 | } |
190 | 175 | ||
191 | #[cfg(test)] | 176 | #[cfg(test)] |