@@ -2232,6 +2232,14 @@ 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 fold < B , F > ( self , init : B , f : F ) -> B
2237+ where
2238+ Self : Sized ,
2239+ F : FnMut ( B , Self :: Item ) -> B ,
2240+ {
2241+ self . base . fold ( init, f)
2242+ }
22352243}
22362244#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22372245impl < K , V > ExactSizeIterator for Iter < ' _ , K , V > {
@@ -2256,6 +2264,14 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
22562264 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
22572265 self . base . size_hint ( )
22582266 }
2267+ #[ inline]
2268+ fn fold < B , F > ( self , init : B , f : F ) -> B
2269+ where
2270+ Self : Sized ,
2271+ F : FnMut ( B , Self :: Item ) -> B ,
2272+ {
2273+ self . base . fold ( init, f)
2274+ }
22592275}
22602276#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22612277impl < K , V > ExactSizeIterator for IterMut < ' _ , K , V > {
@@ -2290,6 +2306,14 @@ impl<K, V> Iterator for IntoIter<K, V> {
22902306 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
22912307 self . base . size_hint ( )
22922308 }
2309+ #[ inline]
2310+ fn fold < B , F > ( self , init : B , f : F ) -> B
2311+ where
2312+ Self : Sized ,
2313+ F : FnMut ( B , Self :: Item ) -> B ,
2314+ {
2315+ self . base . fold ( init, f)
2316+ }
22932317}
22942318#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22952319impl < K , V > ExactSizeIterator for IntoIter < K , V > {
@@ -2320,6 +2344,14 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
23202344 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23212345 self . inner . size_hint ( )
23222346 }
2347+ #[ inline]
2348+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2349+ where
2350+ Self : Sized ,
2351+ F : FnMut ( B , Self :: Item ) -> B ,
2352+ {
2353+ self . inner . fold ( init, |acc, ( k, _) | f ( acc, k) )
2354+ }
23232355}
23242356#[ stable( feature = "rust1" , since = "1.0.0" ) ]
23252357impl < K , V > ExactSizeIterator for Keys < ' _ , K , V > {
@@ -2343,6 +2375,14 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
23432375 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23442376 self . inner . size_hint ( )
23452377 }
2378+ #[ inline]
2379+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2380+ where
2381+ Self : Sized ,
2382+ F : FnMut ( B , Self :: Item ) -> B ,
2383+ {
2384+ self . inner . fold ( init, |acc, ( _, v) | f ( acc, v) )
2385+ }
23462386}
23472387#[ stable( feature = "rust1" , since = "1.0.0" ) ]
23482388impl < K , V > ExactSizeIterator for Values < ' _ , K , V > {
@@ -2366,6 +2406,14 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
23662406 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23672407 self . inner . size_hint ( )
23682408 }
2409+ #[ inline]
2410+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2411+ where
2412+ Self : Sized ,
2413+ F : FnMut ( B , Self :: Item ) -> B ,
2414+ {
2415+ self . inner . fold ( init, |acc, ( _, v) | f ( acc, v) )
2416+ }
23692417}
23702418#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
23712419impl < K , V > ExactSizeIterator for ValuesMut < ' _ , K , V > {
@@ -2396,6 +2444,14 @@ impl<K, V> Iterator for IntoKeys<K, V> {
23962444 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
23972445 self . inner . size_hint ( )
23982446 }
2447+ #[ inline]
2448+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2449+ where
2450+ Self : Sized ,
2451+ F : FnMut ( B , Self :: Item ) -> B ,
2452+ {
2453+ self . inner . fold ( init, |acc, ( k, _) | f ( acc, k) )
2454+ }
23992455}
24002456#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
24012457impl < K , V > ExactSizeIterator for IntoKeys < K , V > {
@@ -2426,6 +2482,14 @@ impl<K, V> Iterator for IntoValues<K, V> {
24262482 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
24272483 self . inner . size_hint ( )
24282484 }
2485+ #[ inline]
2486+ fn fold < B , F > ( self , init : B , mut f : F ) -> B
2487+ where
2488+ Self : Sized ,
2489+ F : FnMut ( B , Self :: Item ) -> B ,
2490+ {
2491+ self . inner . fold ( init, |acc, ( _, v) | f ( acc, v) )
2492+ }
24292493}
24302494#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
24312495impl < K , V > ExactSizeIterator for IntoValues < K , V > {
@@ -2456,6 +2520,14 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
24562520 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
24572521 self . base . size_hint ( )
24582522 }
2523+ #[ inline]
2524+ fn fold < B , F > ( self , init : B , f : F ) -> B
2525+ where
2526+ Self : Sized ,
2527+ F : FnMut ( B , Self :: Item ) -> B ,
2528+ {
2529+ self . base . fold ( init, f)
2530+ }
24592531}
24602532#[ stable( feature = "drain" , since = "1.6.0" ) ]
24612533impl < K , V > ExactSizeIterator for Drain < ' _ , K , V > {
0 commit comments