aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/module.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs
index 24c346984..87e30191f 100644
--- a/crates/ra_hir/src/module.rs
+++ b/crates/ra_hir/src/module.rs
@@ -75,6 +75,11 @@ impl Module {
75 Some(Crate::new(crate_id)) 75 Some(Crate::new(crate_id))
76 } 76 }
77 77
78 /// Returns the all modulkes on the way to the root.
79 pub fn path_to_root(&self) -> Vec<Module> {
80 generate(Some(self.clone()), move |it| it.parent()).collect::<Vec<Module>>()
81 }
82
78 /// The root of the tree this module is part of 83 /// The root of the tree this module is part of
79 pub fn crate_root(&self) -> Module { 84 pub fn crate_root(&self) -> Module {
80 let root_id = self.module_id.crate_root(&self.tree); 85 let root_id = self.module_id.crate_root(&self.tree);