mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-23 00:26:31 +00:00
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
8db9926107
commit
db61ec4a6b
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,
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue