Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/re_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,19 @@ impl<'c> Iterator for SubCapturesPosIter<'c> {
self.idx += 1;
x
}

fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.locs.len() - self.idx;
(len, Some(len))
}

fn count(self) -> usize {
self.len()
}
}

impl<'c> ExactSizeIterator for SubCapturesPosIter<'c> {}

impl<'c> FusedIterator for SubCapturesPosIter<'c> {}

/// `RegularExpression` describes types that can implement regex searching.
Expand Down
10 changes: 10 additions & 0 deletions src/re_unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,18 @@ impl<'c, 't> Iterator for SubCaptureMatches<'c, 't> {
.next()
.map(|cap| cap.map(|(s, e)| Match::new(self.caps.text, s, e)))
}

fn size_hint(&self) -> (usize, Option<usize>) {
self.it.size_hint()
}

fn count(self) -> usize {
self.it.count()
}
}

impl<'c, 't> ExactSizeIterator for SubCaptureMatches<'c, 't> {}

impl<'c, 't> FusedIterator for SubCaptureMatches<'c, 't> {}

/// An iterator that yields all non-overlapping capture groups matching a
Expand Down