diff options
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 63e2e34e8..2f968d97c 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | use ra_db::{CrateId, Cancelable}; | 1 | use ra_db::{CrateId, Cancelable, FileId}; |
2 | use ra_syntax::ast; | ||
2 | 3 | ||
3 | use crate::{Name, db::HirDatabase, DefId}; | 4 | use crate::{Name, db::HirDatabase, DefId}; |
4 | 5 | ||
@@ -17,6 +18,9 @@ pub struct CrateDependency { | |||
17 | } | 18 | } |
18 | 19 | ||
19 | impl Crate { | 20 | impl Crate { |
21 | pub fn crate_id(&self) -> CrateId { | ||
22 | self.crate_id | ||
23 | } | ||
20 | pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> { | 24 | pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> { |
21 | self.dependencies_impl(db) | 25 | self.dependencies_impl(db) |
22 | } | 26 | } |
@@ -31,6 +35,10 @@ pub struct Module { | |||
31 | } | 35 | } |
32 | 36 | ||
33 | impl Module { | 37 | impl Module { |
38 | pub fn source(&self, db: &impl HirDatabase) -> (FileId, Option<ast::ModuleNode>) { | ||
39 | self.source_impl(db) | ||
40 | } | ||
41 | |||
34 | /// Returns the crate this module is part of. | 42 | /// Returns the crate this module is part of. |
35 | pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { | 43 | pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { |
36 | self.krate_impl(db) | 44 | self.krate_impl(db) |