Skip to content

Commit

Permalink
Auto merge of #541 - geeknoid:geeknoid/iters, r=Amanieu
Browse files Browse the repository at this point in the history
Implement Clone and Debug for HashTable's Iter struct

Found those implementations missing, which is preventing me from implementing the same in encapsulating iterators.
  • Loading branch information
bors committed Sep 20, 2024
2 parents 67f704e + e9fd7b4 commit cd9a955
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,23 @@ impl<T> ExactSizeIterator for Iter<'_, T> {

impl<T> FusedIterator for Iter<'_, T> {}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
impl<'a, T> Clone for Iter<'a, T> {
#[cfg_attr(feature = "inline-more", inline)]
fn clone(&self) -> Iter<'a, T> {
Iter {
inner: self.inner.clone(),
marker: PhantomData,
}
}
}

impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}

/// A mutable iterator over the entries of a `HashTable` in arbitrary order.
/// The iterator element type is `&'a mut T`.
///
Expand Down

0 comments on commit cd9a955

Please sign in to comment.