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.
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-09-04 14:34:04 +02:00
parent 8db9926107
commit db61ec4a6b
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5

View file

@ -48,7 +48,6 @@ impl Error for IteratorError {
}
// Implemented manually so that we can use generics for the item
#[derive(Debug)]
pub struct Iterator<T> {
iter: ptr::NonNull<gst_sys::GstIterator>,
borrowed: bool,
@ -468,6 +467,15 @@ impl<T: StaticType + 'static> Clone for Iterator<T> {
}
}
impl<T> fmt::Debug for Iterator<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Iterator")
.field("iter", &self.iter)
.field("borrowed", &self.borrowed)
.finish()
}
}
impl<T> Drop for Iterator<T> {
fn drop(&mut self) {
if !self.borrowed {