@@ -89,6 +89,12 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
8989 }
9090}
9191
92+ impl < K , V > Default for Iter < ' _ , K , V > {
93+ fn default ( ) -> Self {
94+ Self { iter : [ ] . iter ( ) }
95+ }
96+ }
97+
9298/// A mutable iterator over the entries of a `IndexMap`.
9399///
94100/// 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> {
145151 }
146152}
147153
154+ impl < K , V > Default for IterMut < ' _ , K , V > {
155+ fn default ( ) -> Self {
156+ Self {
157+ iter : [ ] . iter_mut ( ) ,
158+ }
159+ }
160+ }
161+
148162/// An owning iterator over the entries of a `IndexMap`.
149163///
150164/// 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> {
199213 }
200214}
201215
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+
202224/// A draining iterator over the entries of a `IndexMap`.
203225///
204226/// 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> {
298320 }
299321}
300322
323+ impl < K , V > Default for Keys < ' _ , K , V > {
324+ fn default ( ) -> Self {
325+ Self { iter : [ ] . iter ( ) }
326+ }
327+ }
328+
301329/// An owning iterator over the keys of a `IndexMap`.
302330///
303331/// 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> {
342370 }
343371}
344372
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+
345381/// An iterator over the values of a `IndexMap`.
346382///
347383/// 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> {
394430 }
395431}
396432
433+ impl < K , V > Default for Values < ' _ , K , V > {
434+ fn default ( ) -> Self {
435+ Self { iter : [ ] . iter ( ) }
436+ }
437+ }
438+
397439/// A mutable iterator over the values of a `IndexMap`.
398440///
399441/// 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> {
438480 }
439481}
440482
483+ impl < K , V > Default for ValuesMut < ' _ , K , V > {
484+ fn default ( ) -> Self {
485+ Self {
486+ iter : [ ] . iter_mut ( ) ,
487+ }
488+ }
489+ }
490+
441491/// An owning iterator over the values of a `IndexMap`.
442492///
443493/// 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> {
481531 f. debug_list ( ) . entries ( iter) . finish ( )
482532 }
483533}
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