diff options
author | Pascal Kuthe | 2023-03-09 21:09:12 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-03-10 07:54:17 +0000 |
commit | e91289fda1c81bc3f3cc32735a1b6841e6df55a5 (patch) | |
tree | 9d6a20e7fb8b49d4179083bab19387c4356aede1 /helix-core | |
parent | 9b4326b18b24fa8ec8ffd0cb261a8c82ecad32d6 (diff) |
Add IntoIterator implementation for Selection
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/src/selection.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index 0eb2b755..8e93c633 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -661,6 +661,15 @@ impl<'a> IntoIterator for &'a Selection { } } +impl IntoIterator for Selection { + type Item = Range; + type IntoIter = smallvec::IntoIter<[Range; 1]>; + + fn into_iter(self) -> smallvec::IntoIter<[Range; 1]> { + self.ranges.into_iter() + } +} + // TODO: checkSelection -> check if valid for doc length && sorted pub fn keep_or_remove_matches( |