forked from mirrors/gstreamer-rs
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:
parent
5149dc254d
commit
de85702408
1 changed files with 9 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue