on master help sign in
Add IntoIterator implementation for Selection
commite91289fda1c81bc3f3cc32735a1b6841e6df55a5 authorPascal Kuthe <pascal.kuthe@semimod.de> dateThu 9 Mar 2023, 22:09 (4 years ago) parent9b4326b
1 file changed+9
helix-core/src/selection.rs+9
helix-core/src/selection.rs+9
@@ -661,6 +661,15 @@ impl<'a> IntoIterator for &'a Selection {
661661 }
662662}
663663
664+impl IntoIterator for Selection {
665+ type Item = Range;
666+ type IntoIter = smallvec::IntoIter<[Range; 1]>;
667+
668+ fn into_iter(self) -> smallvec::IntoIter<[Range; 1]> {
669+ self.ranges.into_iter()
670+ }
671+}
672+
664673// TODO: checkSelection -> check if valid for doc length && sorted
665674
666675pub fn keep_or_remove_matches(