diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 62a445896..558ad5d7b 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -1,6 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; +use std::fmt; pub trait IsMiniObject: AsRef + FromGlibPtrFull<*mut Self::FfiType> + Send + Sync + 'static @@ -553,6 +554,21 @@ impl MiniObject { } } +impl fmt::Debug for MiniObject { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.as_ref().fmt(f) + } +} + +impl fmt::Debug for MiniObjectRef { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MiniObject") + .field("ptr", unsafe { &self.as_ptr() }) + .field("type", &self.type_()) + .finish() + } +} + impl MiniObjectRef { pub fn type_(&self) -> glib::Type { unsafe { from_glib((*self.as_ptr()).type_) }