From 53c98db7110ef188157c27e73b748a1d008118b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 21 Feb 2019 18:48:57 +0200 Subject: [PATCH] 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. --- gstreamer/src/clock.rs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 4e6795950..dec438902 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -24,7 +24,7 @@ use ClockTime; use ClockTimeDiff; glib_wrapper! { - #[derive(Debug, Hash)] + #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct ClockId(Shared); match fn { @@ -95,16 +95,8 @@ impl ClockId { }; ret.into_result() } -} -impl PartialOrd for ClockId { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Ord for ClockId { - fn cmp(&self, other: &Self) -> cmp::Ordering { + pub fn compare_by_time(&self, other: &Self) -> cmp::Ordering { unsafe { let res = ffi::gst_clock_id_compare_func(self.to_glib_none().0, other.to_glib_none().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 Sync for ClockId {}