Skip to content

Commit

Permalink
impl Debug for ParIterMut
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jul 30, 2021
1 parent 2b9cbea commit 19789dc
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 @@ -1057,6 +1057,8 @@ impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {

impl<K, V> FusedIterator for IterMut<'_, K, V> {}

// TODO: `impl Debug for IterMut` once we have MSRV 1.53 for `slice::IterMut::as_slice`

/// An owning iterator over the entries of a `IndexMap`.
///
/// This `struct` is created by the [`into_iter`] 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 @@ -139,6 +139,13 @@ pub struct ParIterMut<'a, K, V> {
entries: &'a mut [Bucket<K, V>],
}

impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for ParIterMut<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let iter = self.entries.iter().map(Bucket::refs);
f.debug_list().entries(iter).finish()
}
}

impl<'a, K: Sync + Send, V: Send> ParallelIterator for ParIterMut<'a, K, V> {
type Item = (&'a K, &'a mut V);

Expand Down

0 comments on commit 19789dc

Please sign in to comment.