@@ -89,6 +89,12 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
89
89
}
90
90
}
91
91
92
+ impl < K , V > Default for Iter < ' _ , K , V > {
93
+ fn default ( ) -> Self {
94
+ Self { iter : [ ] . iter ( ) }
95
+ }
96
+ }
97
+
92
98
/// A mutable iterator over the entries of a `IndexMap`.
93
99
///
94
100
/// This `struct` is created by the [`iter_mut`] method on [`IndexMap`]. See its
@@ -145,6 +151,14 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IterMut<'_, K, V> {
145
151
}
146
152
}
147
153
154
+ impl < K , V > Default for IterMut < ' _ , K , V > {
155
+ fn default ( ) -> Self {
156
+ Self {
157
+ iter : [ ] . iter_mut ( ) ,
158
+ }
159
+ }
160
+ }
161
+
148
162
/// An owning iterator over the entries of a `IndexMap`.
149
163
///
150
164
/// This `struct` is created by the [`into_iter`] method on [`IndexMap`]
@@ -199,6 +213,14 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
199
213
}
200
214
}
201
215
216
+ impl < K , V > Default for IntoIter < K , V > {
217
+ fn default ( ) -> Self {
218
+ Self {
219
+ iter : Vec :: new ( ) . into_iter ( ) ,
220
+ }
221
+ }
222
+ }
223
+
202
224
/// A draining iterator over the entries of a `IndexMap`.
203
225
///
204
226
/// This `struct` is created by the [`drain`] method on [`IndexMap`]. See its
@@ -298,6 +320,12 @@ impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> {
298
320
}
299
321
}
300
322
323
+ impl < K , V > Default for Keys < ' _ , K , V > {
324
+ fn default ( ) -> Self {
325
+ Self { iter : [ ] . iter ( ) }
326
+ }
327
+ }
328
+
301
329
/// An owning iterator over the keys of a `IndexMap`.
302
330
///
303
331
/// This `struct` is created by the [`into_keys`] method on [`IndexMap`].
@@ -342,6 +370,14 @@ impl<K: fmt::Debug, V> fmt::Debug for IntoKeys<K, V> {
342
370
}
343
371
}
344
372
373
+ impl < K , V > Default for IntoKeys < K , V > {
374
+ fn default ( ) -> Self {
375
+ Self {
376
+ iter : Vec :: new ( ) . into_iter ( ) ,
377
+ }
378
+ }
379
+ }
380
+
345
381
/// An iterator over the values of a `IndexMap`.
346
382
///
347
383
/// This `struct` is created by the [`values`] method on [`IndexMap`]. See its
@@ -394,6 +430,12 @@ impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
394
430
}
395
431
}
396
432
433
+ impl < K , V > Default for Values < ' _ , K , V > {
434
+ fn default ( ) -> Self {
435
+ Self { iter : [ ] . iter ( ) }
436
+ }
437
+ }
438
+
397
439
/// A mutable iterator over the values of a `IndexMap`.
398
440
///
399
441
/// This `struct` is created by the [`values_mut`] method on [`IndexMap`]. See its
@@ -438,6 +480,14 @@ impl<K, V: fmt::Debug> fmt::Debug for ValuesMut<'_, K, V> {
438
480
}
439
481
}
440
482
483
+ impl < K , V > Default for ValuesMut < ' _ , K , V > {
484
+ fn default ( ) -> Self {
485
+ Self {
486
+ iter : [ ] . iter_mut ( ) ,
487
+ }
488
+ }
489
+ }
490
+
441
491
/// An owning iterator over the values of a `IndexMap`.
442
492
///
443
493
/// This `struct` is created by the [`into_values`] method on [`IndexMap`].
@@ -481,3 +531,11 @@ impl<K, V: fmt::Debug> fmt::Debug for IntoValues<K, V> {
481
531
f. debug_list ( ) . entries ( iter) . finish ( )
482
532
}
483
533
}
534
+
535
+ impl < K , V > Default for IntoValues < K , V > {
536
+ fn default ( ) -> Self {
537
+ Self {
538
+ iter : Vec :: new ( ) . into_iter ( ) ,
539
+ }
540
+ }
541
+ }
0 commit comments