@@ -2232,6 +2232,18 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
2232
2232
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2233
2233
self . base . size_hint ( )
2234
2234
}
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
+ }
2235
2247
}
2236
2248
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2237
2249
impl < K , V > ExactSizeIterator for Iter < ' _ , K , V > {
@@ -2256,6 +2268,18 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
2256
2268
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2257
2269
self . base . size_hint ( )
2258
2270
}
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
+ }
2259
2283
}
2260
2284
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2261
2285
impl < K , V > ExactSizeIterator for IterMut < ' _ , K , V > {
@@ -2290,6 +2314,18 @@ impl<K, V> Iterator for IntoIter<K, V> {
2290
2314
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2291
2315
self . base . size_hint ( )
2292
2316
}
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
+ }
2293
2329
}
2294
2330
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2295
2331
impl < K , V > ExactSizeIterator for IntoIter < K , V > {
@@ -2320,6 +2356,18 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
2320
2356
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2321
2357
self . inner . size_hint ( )
2322
2358
}
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
+ }
2323
2371
}
2324
2372
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2325
2373
impl < K , V > ExactSizeIterator for Keys < ' _ , K , V > {
@@ -2343,6 +2391,18 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
2343
2391
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2344
2392
self . inner . size_hint ( )
2345
2393
}
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
+ }
2346
2406
}
2347
2407
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2348
2408
impl < K , V > ExactSizeIterator for Values < ' _ , K , V > {
@@ -2366,6 +2426,18 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
2366
2426
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2367
2427
self . inner . size_hint ( )
2368
2428
}
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
+ }
2369
2441
}
2370
2442
#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
2371
2443
impl < K , V > ExactSizeIterator for ValuesMut < ' _ , K , V > {
@@ -2396,6 +2468,18 @@ impl<K, V> Iterator for IntoKeys<K, V> {
2396
2468
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2397
2469
self . inner . size_hint ( )
2398
2470
}
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
+ }
2399
2483
}
2400
2484
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
2401
2485
impl < K , V > ExactSizeIterator for IntoKeys < K , V > {
@@ -2426,6 +2510,18 @@ impl<K, V> Iterator for IntoValues<K, V> {
2426
2510
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2427
2511
self . inner . size_hint ( )
2428
2512
}
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
+ }
2429
2525
}
2430
2526
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
2431
2527
impl < K , V > ExactSizeIterator for IntoValues < K , V > {
@@ -2456,6 +2552,14 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
2456
2552
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
2457
2553
self . base . size_hint ( )
2458
2554
}
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
+ }
2459
2563
}
2460
2564
#[ stable( feature = "drain" , since = "1.6.0" ) ]
2461
2565
impl < K , V > ExactSizeIterator for Drain < ' _ , K , V > {
0 commit comments