Skip to content

Commit

Permalink
Implement Iterator::size_hint method
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored and zonyitoo committed Mar 29, 2021
1 parent fc07df6 commit 23d1dea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,10 @@ impl<'a> Iterator for SectionIter<'a> {
fn next(&mut self) -> Option<Self::Item> {
self.inner.next().map(|(k, v)| (k.as_ref().map(|s| s.as_str()), v))
}

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

impl DoubleEndedIterator for SectionIter<'_> {
Expand All @@ -888,6 +892,10 @@ impl<'a> Iterator for SectionIterMut<'a> {
fn next(&mut self) -> Option<Self::Item> {
self.inner.next().map(|(k, v)| (k.as_ref().map(|s| s.as_str()), v))
}

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

impl DoubleEndedIterator for SectionIterMut<'_> {
Expand Down

0 comments on commit 23d1dea

Please sign in to comment.