aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-02 03:52:32 +0000
committerBlaž Hrastnik2021-09-06 06:25:46 +0000
commit59ed1c8c78ab996273bcc910c11724bc8402f711 (patch)
treedb992cf2b920705ecfc8ff776bbff1572eb43e97 /helix-view/src/editor.rs
parentdc7799b980826ffe33ed635968def79daf20bd10 (diff)
Simplify documents & documents_mut()
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 0d914e45..c8abd5b5 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -319,20 +319,24 @@ impl Editor {
view.ensure_cursor_in_view(doc, self.config.scrolloff)
}
+ #[inline]
pub fn document(&self, id: DocumentId) -> Option<&Document> {
self.documents.get(id)
}
+ #[inline]
pub fn document_mut(&mut self, id: DocumentId) -> Option<&mut Document> {
self.documents.get_mut(id)
}
+ #[inline]
pub fn documents(&self) -> impl Iterator<Item = &Document> {
- self.documents.iter().map(|(_id, doc)| doc)
+ self.documents.values()
}
+ #[inline]
pub fn documents_mut(&mut self) -> impl Iterator<Item = &mut Document> {
- self.documents.iter_mut().map(|(_id, doc)| doc)
+ self.documents.values_mut()
}
pub fn document_by_path<P: AsRef<Path>>(&self, path: P) -> Option<&Document> {