gstreamer: Don't implement ClockId's Ord/etc based on the compare function

It is only comparing the times, and two clock ids with the same time are
obviously not the same.
This commit is contained in:
Sebastian Dröge 2019-02-21 18:48:57 +02:00
parent 2471676aa4
commit 53c98db711

View file

@ -24,7 +24,7 @@ use ClockTime;
use ClockTimeDiff; use ClockTimeDiff;
glib_wrapper! { glib_wrapper! {
#[derive(Debug, Hash)] #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
pub struct ClockId(Shared<c_void>); pub struct ClockId(Shared<c_void>);
match fn { match fn {
@ -95,16 +95,8 @@ impl ClockId {
}; };
ret.into_result() ret.into_result()
} }
}
impl PartialOrd for ClockId { pub fn compare_by_time(&self, other: &Self) -> cmp::Ordering {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
Some(self.cmp(other))
}
}
impl Ord for ClockId {
fn cmp(&self, other: &Self) -> cmp::Ordering {
unsafe { unsafe {
let res = ffi::gst_clock_id_compare_func(self.to_glib_none().0, other.to_glib_none().0); let res = ffi::gst_clock_id_compare_func(self.to_glib_none().0, other.to_glib_none().0);
if res < 0 { if res < 0 {
@ -118,14 +110,6 @@ impl Ord for ClockId {
} }
} }
impl PartialEq for ClockId {
fn eq(&self, other: &Self) -> bool {
self.cmp(other) == cmp::Ordering::Equal
}
}
impl Eq for ClockId {}
unsafe impl Send for ClockId {} unsafe impl Send for ClockId {}
unsafe impl Sync for ClockId {} unsafe impl Sync for ClockId {}