aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_tt/src/buffer.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_tt/src/buffer.rs b/crates/ra_tt/src/buffer.rs
index 56b844b8b..940f2b807 100644
--- a/crates/ra_tt/src/buffer.rs
+++ b/crates/ra_tt/src/buffer.rs
@@ -166,4 +166,19 @@ impl<'a> Cursor<'a> {
166 Cursor::create(self.buffer, EntryPtr(self.ptr.0, self.ptr.1 + 1)) 166 Cursor::create(self.buffer, EntryPtr(self.ptr.0, self.ptr.1 + 1))
167 } 167 }
168 } 168 }
169
170 /// Bump the cursor, if it is a subtree, returns
171 /// a cursor into that subtree
172 pub fn bump_subtree(self) -> Cursor<'a> {
173 match self.entry() {
174 Some(Entry::Subtree(_, _)) => self.subtree().unwrap(),
175 _ => self.bump(),
176 }
177 }
178
179 /// Check whether it is a top level
180 pub fn is_root(&self) -> bool {
181 let entry_id = self.ptr.0;
182 return entry_id.0 == 0;
183 }
169} 184}