diff --git a/src/lib.rs b/src/lib.rs index 511f272..06cd1f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1073,6 +1073,11 @@ impl Iterator for Drain<'_, T, N> { let len = self.inner.len(); (len, Some(len)) } + + fn count(self) -> usize + where Self: Sized { + self.len() + } } impl ExactSizeIterator for Drain<'_, T, N> { @@ -1136,6 +1141,11 @@ impl Iterator for IntoIter { let len = self.0.len(); (len, Some(len)) } + + fn count(self) -> usize + where Self: Sized { + self.len() + } } impl DoubleEndedIterator for IntoIter { @@ -1158,6 +1168,7 @@ impl DoubleEndedIterator for IntoIter { impl FusedIterator for IntoIter {} impl ExactSizeIterator for IntoIter { + #[inline] fn len(&self) -> usize { self.0.len() } @@ -1224,6 +1235,11 @@ impl Iterator for Iter<'_, T, N> { let len = self.borrow.len() - self.passed_count; (len, Some(len)) } + + fn count(self) -> usize + where Self: Sized { + self.len() + } } impl DoubleEndedIterator for Iter<'_, T, N> { @@ -1244,6 +1260,7 @@ impl DoubleEndedIterator for Iter<'_, T, N> { impl FusedIterator for Iter<'_, T, N> {} impl ExactSizeIterator for Iter<'_, T, N> { + #[inline] fn len(&self) -> usize { self.borrow.len() - self.passed_count }