Skip to content

Commit e9fd7b4

Browse files
author
Martin Taillefer (from Dev Box)
committed
Implement Clone and Debug for HashTable's Iter struct
1 parent a69af93 commit e9fd7b4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/table.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,23 @@ impl<T> ExactSizeIterator for Iter<'_, T> {
19691969

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

1972+
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
1973+
impl<'a, T> Clone for Iter<'a, T> {
1974+
#[cfg_attr(feature = "inline-more", inline)]
1975+
fn clone(&self) -> Iter<'a, T> {
1976+
Iter {
1977+
inner: self.inner.clone(),
1978+
marker: PhantomData,
1979+
}
1980+
}
1981+
}
1982+
1983+
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
1984+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1985+
f.debug_list().entries(self.clone()).finish()
1986+
}
1987+
}
1988+
19721989
/// A mutable iterator over the entries of a `HashTable` in arbitrary order.
19731990
/// The iterator element type is `&'a mut T`.
19741991
///

0 commit comments

Comments
 (0)