@@ -2232,6 +2232,18 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
22322232 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
22332233 self . base . size_hint ( )
22342234 }
2235+ #[ inline]
2236+ fn count ( self ) -> usize {
2237+ self . base . len ( )
2238+ }
2239+ #[ inline]
2240+ fn fold < B , F > ( self , init : B , f : F ) -> B
2241+ where
2242+ Self : Sized ,
2243+ F : FnMut ( B , Self :: Item ) -> B ,
2244+ {
2245+ self . base . fold ( init, f)
2246+ }
22352247}
22362248#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22372249impl < K , V > ExactSizeIterator for Iter < ' _ , K , V > {
@@ -2256,6 +2268,18 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
22562268 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
22572269 self . base . size_hint ( )
22582270 }
2271+ #[ inline]
2272+ fn count ( self ) -> usize {
2273+ self . base . len ( )
2274+ }
2275+ #[ inline]
2276+ fn fold < B , F > ( self , init : B , f : F ) -> B
2277+ where
2278+ Self : Sized ,
2279+ F : FnMut ( B , Self :: Item ) -> B ,
2280+ {
2281+ self . base . fold ( init, f)
2282+ }
22592283}
22602284#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22612285impl < K , V > ExactSizeIterator for IterMut < ' _ , K , V > {
@@ -2290,6 +2314,18 @@ impl<K, V> Iterator for IntoIter<K, V> {
22902314 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
22912315 self . base . size_hint ( )
22922316 }
2317+ #[ inline]
2318+ fn count ( self ) -> usize {
2319+ self . base . len ( )
2320+ }
2321+ #[ inline]
2322+ fn fold < B , F > ( self , init : B , f : F ) -> B
2323+ where
2324+ Self : Sized ,
2325+ F : FnMut ( B , Self :: Item ) -> B ,
2326+ {
2327+ self . base . fold ( init, f)
2328+ }
22932329}
22942330#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22952331impl < K , V > ExactSizeIterator for IntoIter < K , V > {
@@ -2320,6 +2356,18 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
23202356 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23212357 self . inner . size_hint ( )
23222358 }
2359+ #[ inline]
2360+ fn count ( self ) -> usize {
2361+ self . inner . len ( )
2362+ }
2363+ #[ inline]
2364+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2365+ where
2366+ Self : Sized ,
2367+ F : FnMut ( B , Self :: Item ) -> B ,
2368+ {
2369+ self . inner . fold ( init, |acc, ( k, _) | f ( acc, k) )
2370+ }
23232371}
23242372#[ stable( feature = "rust1" , since = "1.0.0" ) ]
23252373impl < K , V > ExactSizeIterator for Keys < ' _ , K , V > {
@@ -2343,6 +2391,18 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
23432391 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23442392 self . inner . size_hint ( )
23452393 }
2394+ #[ inline]
2395+ fn count ( self ) -> usize {
2396+ self . inner . len ( )
2397+ }
2398+ #[ inline]
2399+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2400+ where
2401+ Self : Sized ,
2402+ F : FnMut ( B , Self :: Item ) -> B ,
2403+ {
2404+ self . inner . fold ( init, |acc, ( _, v) | f ( acc, v) )
2405+ }
23462406}
23472407#[ stable( feature = "rust1" , since = "1.0.0" ) ]
23482408impl < K , V > ExactSizeIterator for Values < ' _ , K , V > {
@@ -2366,6 +2426,18 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
23662426 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23672427 self . inner . size_hint ( )
23682428 }
2429+ #[ inline]
2430+ fn count ( self ) -> usize {
2431+ self . inner . len ( )
2432+ }
2433+ #[ inline]
2434+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2435+ where
2436+ Self : Sized ,
2437+ F : FnMut ( B , Self :: Item ) -> B ,
2438+ {
2439+ self . inner . fold ( init, |acc, ( _, v) | f ( acc, v) )
2440+ }
23692441}
23702442#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
23712443impl < K , V > ExactSizeIterator for ValuesMut < ' _ , K , V > {
@@ -2396,6 +2468,18 @@ impl<K, V> Iterator for IntoKeys<K, V> {
23962468 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23972469 self . inner . size_hint ( )
23982470 }
2471+ #[ inline]
2472+ fn count ( self ) -> usize {
2473+ self . inner . len ( )
2474+ }
2475+ #[ inline]
2476+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2477+ where
2478+ Self : Sized ,
2479+ F : FnMut ( B , Self :: Item ) -> B ,
2480+ {
2481+ self . inner . fold ( init, |acc, ( k, _) | f ( acc, k) )
2482+ }
23992483}
24002484#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
24012485impl < K , V > ExactSizeIterator for IntoKeys < K , V > {
@@ -2426,6 +2510,18 @@ impl<K, V> Iterator for IntoValues<K, V> {
24262510 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
24272511 self . inner . size_hint ( )
24282512 }
2513+ #[ inline]
2514+ fn count ( self ) -> usize {
2515+ self . inner . len ( )
2516+ }
2517+ #[ inline]
2518+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2519+ where
2520+ Self : Sized ,
2521+ F : FnMut ( B , Self :: Item ) -> B ,
2522+ {
2523+ self . inner . fold ( init, |acc, ( _, v) | f ( acc, v) )
2524+ }
24292525}
24302526#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
24312527impl < K , V > ExactSizeIterator for IntoValues < K , V > {
@@ -2456,6 +2552,14 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
24562552 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
24572553 self . base . size_hint ( )
24582554 }
2555+ #[ inline]
2556+ fn fold < B , F > ( self , init : B , f : F ) -> B
2557+ where
2558+ Self : Sized ,
2559+ F : FnMut ( B , Self :: Item ) -> B ,
2560+ {
2561+ self . base . fold ( init, f)
2562+ }
24592563}
24602564#[ stable( feature = "drain" , since = "1.6.0" ) ]
24612565impl < K , V > ExactSizeIterator for Drain < ' _ , K , V > {
0 commit comments