From de8570240892ff84fd53a6ae4867e4fbdf396f86 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Wed, 4 Sep 2019 14:34:04 +0200 Subject: [PATCH] Iterator: Manually implement Debug The derived implementation is restricted to `where T: Debug`, but the iterator doesn't actually contain a value of type T. --- gstreamer/src/iterator.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 37c689097..1e7a8e3a5 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -48,7 +48,6 @@ impl Error for IteratorError { } // Implemented manually so that we can use generics for the item -#[derive(Debug)] pub struct Iterator { iter: ptr::NonNull, borrowed: bool, @@ -462,6 +461,15 @@ impl Clone for Iterator { } } +impl fmt::Debug for Iterator { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Iterator") + .field("iter", &self.iter) + .field("borrowed", &self.borrowed) + .finish() + } +} + impl Drop for Iterator { fn drop(&mut self) { if !self.borrowed {