Skip to content

Commit

Permalink
impl Debug for ParValuesMut
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jul 30, 2021
1 parent 19789dc commit e594967
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,8 @@ impl<K, V> ExactSizeIterator for ValuesMut<'_, K, V> {

impl<K, V> 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`].
Expand Down
7 changes: 7 additions & 0 deletions src/rayon/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ pub struct ParValuesMut<'a, K, V> {
entries: &'a mut [Bucket<K, V>],
}

impl<K, V: fmt::Debug> 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;

Expand Down

0 comments on commit e594967

Please sign in to comment.