From 46b64537cb227b1611c2f05d4b02fb0f1ac20be1 Mon Sep 17 00:00:00 2001 From: Clar Fon Date: Sun, 28 Oct 2018 17:28:55 -0400 Subject: [PATCH] Implement Clone, Debug for IntoIter --- src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 96e7a24..8f08401 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -748,6 +748,30 @@ impl Drop for IntoIter { } } +impl Clone for IntoIter +where + A::Item: Clone, +{ + fn clone(&self) -> IntoIter { + self.v[self.index.to_usize()..] + .iter() + .cloned() + .collect::>() + .into_iter() + } +} + +impl fmt::Debug for IntoIter +where + A::Item: fmt::Debug, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list() + .entries(&self.v[self.index.to_usize()..]) + .finish() + } +} + /// A draining iterator for `ArrayVec`. pub struct Drain<'a, A> where A: Array,