Specialize count too

This commit is contained in:
Benoît du Garreau 2023-11-27 10:30:12 +01:00
parent 6318cbbe49
commit 7d369f9830
2 changed files with 44 additions and 0 deletions

View File

@ -2233,6 +2233,10 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
self.base.size_hint()
}
#[inline]
fn count(self) -> usize {
self.base.len()
}
#[inline]
fn fold<B, F>(self, init: B, f: F) -> B
where
Self: Sized,
@ -2265,6 +2269,10 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
self.base.size_hint()
}
#[inline]
fn count(self) -> usize {
self.base.len()
}
#[inline]
fn fold<B, F>(self, init: B, f: F) -> B
where
Self: Sized,
@ -2307,6 +2315,10 @@ impl<K, V> Iterator for IntoIter<K, V> {
self.base.size_hint()
}
#[inline]
fn count(self) -> usize {
self.base.len()
}
#[inline]
fn fold<B, F>(self, init: B, f: F) -> B
where
Self: Sized,
@ -2345,6 +2357,10 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
self.inner.size_hint()
}
#[inline]
fn count(self) -> usize {
self.inner.len()
}
#[inline]
fn fold<B, F>(self, init: B, mut f: F) -> B
where
Self: Sized,
@ -2376,6 +2392,10 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
self.inner.size_hint()
}
#[inline]
fn count(self) -> usize {
self.inner.len()
}
#[inline]
fn fold<B, F>(self, init: B, mut f: F) -> B
where
Self: Sized,
@ -2407,6 +2427,10 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
self.inner.size_hint()
}
#[inline]
fn count(self) -> usize {
self.inner.len()
}
#[inline]
fn fold<B, F>(self, init: B, mut f: F) -> B
where
Self: Sized,
@ -2445,6 +2469,10 @@ impl<K, V> Iterator for IntoKeys<K, V> {
self.inner.size_hint()
}
#[inline]
fn count(self) -> usize {
self.inner.len()
}
#[inline]
fn fold<B, F>(self, init: B, mut f: F) -> B
where
Self: Sized,
@ -2483,6 +2511,10 @@ impl<K, V> Iterator for IntoValues<K, V> {
self.inner.size_hint()
}
#[inline]
fn count(self) -> usize {
self.inner.len()
}
#[inline]
fn fold<B, F>(self, init: B, mut f: F) -> B
where
Self: Sized,

View File

@ -1501,6 +1501,10 @@ impl<'a, K> Iterator for Iter<'a, K> {
self.base.size_hint()
}
#[inline]
fn count(self) -> usize {
self.base.len()
}
#[inline]
fn fold<B, F>(self, init: B, f: F) -> B
where
Self: Sized,
@ -1539,6 +1543,10 @@ impl<K> Iterator for IntoIter<K> {
self.base.size_hint()
}
#[inline]
fn count(self) -> usize {
self.base.len()
}
#[inline]
fn fold<B, F>(self, init: B, f: F) -> B
where
Self: Sized,
@ -1851,6 +1859,10 @@ where
self.iter.size_hint()
}
#[inline]
fn count(self) -> usize {
self.iter.count()
}
#[inline]
fn fold<B, F>(self, init: B, f: F) -> B
where
Self: Sized,