From e594967b47b9f1dedbf8b9693b61a38f2994aa69 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 30 Jul 2021 16:25:23 -0700 Subject: [PATCH] impl Debug for ParValuesMut --- src/map.rs | 2 ++ src/rayon/map.rs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/map.rs b/src/map.rs index 4beb5f44..3a43a79b 100644 --- a/src/map.rs +++ b/src/map.rs @@ -948,6 +948,8 @@ impl ExactSizeIterator for ValuesMut<'_, K, V> { impl FusedIterator for ValuesMut<'_, K, V> {} +// TODO: `impl Debug for ValuesMut` once we have MSRV 1.53 for `slice::IterMut::as_slice` + /// An owning iterator over the values of a `IndexMap`. /// /// This `struct` is created by the [`into_values`] method on [`IndexMap`]. diff --git a/src/rayon/map.rs b/src/rayon/map.rs index 1bfce60c..bedad3c4 100644 --- a/src/rayon/map.rs +++ b/src/rayon/map.rs @@ -346,6 +346,13 @@ pub struct ParValuesMut<'a, K, V> { entries: &'a mut [Bucket], } +impl fmt::Debug for ParValuesMut<'_, K, V> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let iter = self.entries.iter().map(Bucket::value_ref); + f.debug_list().entries(iter).finish() + } +} + impl<'a, K: Send, V: Send> ParallelIterator for ParValuesMut<'a, K, V> { type Item = &'a mut V;