diff options
Diffstat (limited to 'crates/base_db/src')
-rw-r--r-- | crates/base_db/src/input.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs index f3d65cdf0..9a61f1d56 100644 --- a/crates/base_db/src/input.rs +++ b/crates/base_db/src/input.rs | |||
@@ -12,7 +12,7 @@ use cfg::CfgOptions; | |||
12 | use rustc_hash::{FxHashMap, FxHashSet}; | 12 | use rustc_hash::{FxHashMap, FxHashSet}; |
13 | use syntax::SmolStr; | 13 | use syntax::SmolStr; |
14 | use tt::TokenExpander; | 14 | use tt::TokenExpander; |
15 | use vfs::file_set::FileSet; | 15 | use vfs::{file_set::FileSet, VfsPath}; |
16 | 16 | ||
17 | pub use vfs::FileId; | 17 | pub use vfs::FileId; |
18 | 18 | ||
@@ -43,6 +43,12 @@ impl SourceRoot { | |||
43 | pub fn new_library(file_set: FileSet) -> SourceRoot { | 43 | pub fn new_library(file_set: FileSet) -> SourceRoot { |
44 | SourceRoot { is_library: true, file_set } | 44 | SourceRoot { is_library: true, file_set } |
45 | } | 45 | } |
46 | pub fn path_for_file(&self, file: &FileId) -> Option<&VfsPath> { | ||
47 | self.file_set.path_for_file(file) | ||
48 | } | ||
49 | pub fn file_for_path(&self, path: &VfsPath) -> Option<&FileId> { | ||
50 | self.file_set.file_for_path(path) | ||
51 | } | ||
46 | pub fn iter(&self) -> impl Iterator<Item = FileId> + '_ { | 52 | pub fn iter(&self) -> impl Iterator<Item = FileId> + '_ { |
47 | self.file_set.iter() | 53 | self.file_set.iter() |
48 | } | 54 | } |