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 committed by Sebastian Dröge
parent 5149dc254d
commit de85702408

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,
@ -462,6 +461,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 {