log: Add as_ptr() and Hash to DebugCategory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1612>
This commit is contained in:
Piotr Brzeziński 2024-12-11 17:48:52 +01:00
parent 6e9a499146
commit a0de8269f1

View file

@ -68,7 +68,7 @@ impl DebugMessage {
} }
} }
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(PartialEq, Eq, Clone, Copy, Hash)]
#[doc(alias = "GstDebugCategory")] #[doc(alias = "GstDebugCategory")]
#[repr(transparent)] #[repr(transparent)]
pub struct DebugCategory(Option<ptr::NonNull<ffi::GstDebugCategory>>); pub struct DebugCategory(Option<ptr::NonNull<ffi::GstDebugCategory>>);
@ -530,6 +530,11 @@ impl DebugCategory {
)) ))
} }
} }
#[inline]
pub fn as_ptr(&self) -> *mut ffi::GstDebugCategory {
self.0.map(|p| p.as_ptr()).unwrap_or(ptr::null_mut())
}
} }
unsafe impl Sync for DebugCategory {} unsafe impl Sync for DebugCategory {}