Skip to content

Commit 46b6453

Browse files
author
Clar Fon
committed
Implement Clone, Debug for IntoIter
1 parent 16aabf7 commit 46b6453

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,30 @@ impl<A: Array> Drop for IntoIter<A> {
748748
}
749749
}
750750

751+
impl<A: Array> Clone for IntoIter<A>
752+
where
753+
A::Item: Clone,
754+
{
755+
fn clone(&self) -> IntoIter<A> {
756+
self.v[self.index.to_usize()..]
757+
.iter()
758+
.cloned()
759+
.collect::<ArrayVec<A>>()
760+
.into_iter()
761+
}
762+
}
763+
764+
impl<A: Array> fmt::Debug for IntoIter<A>
765+
where
766+
A::Item: fmt::Debug,
767+
{
768+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
769+
f.debug_list()
770+
.entries(&self.v[self.index.to_usize()..])
771+
.finish()
772+
}
773+
}
774+
751775
/// A draining iterator for `ArrayVec`.
752776
pub struct Drain<'a, A>
753777
where A: Array,

0 commit comments

Comments
 (0)