forked from mirrors/gstreamer-rs
Properly implement Eq/PartialEq/Debug for miniobjects
This commit is contained in:
parent
31b65e572c
commit
f00af84105
1 changed files with 14 additions and 1 deletions
|
@ -21,7 +21,6 @@ use glib::translate::{c_ptr_array_len, from_glib, from_glib_full, from_glib_none
|
|||
ToGlibContainerFromSlice, ToGlibPtr, ToGlibPtrMut};
|
||||
use glib;
|
||||
|
||||
#[derive(Hash, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct GstRc<T: MiniObject> {
|
||||
obj: *mut T,
|
||||
borrowed: bool,
|
||||
|
@ -157,6 +156,20 @@ impl<T: MiniObject> Drop for GstRc<T> {
|
|||
unsafe impl<T: MiniObject + Sync + Send> Sync for GstRc<T> {}
|
||||
unsafe impl<T: MiniObject + Sync + Send> Send for GstRc<T> {}
|
||||
|
||||
impl<T: MiniObject + PartialEq> PartialEq for GstRc<T> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.as_ref().eq(other.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: MiniObject + Eq> Eq for GstRc<T> { }
|
||||
|
||||
impl<T: MiniObject + fmt::Debug> fmt::Debug for GstRc<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(unsafe { &*self.obj }).fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: MiniObject + fmt::Display> fmt::Display for GstRc<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(unsafe { &*self.obj }).fmt(f)
|
||||
|
|
Loading…
Reference in a new issue