From db61ec4a6b2b8d84afdf974c2c85c192089d8ed9 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 9879db75f..2bdb750b1 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, @@ -468,6 +467,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 {