mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 13:01:05 +00:00
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:
parent
2471676aa4
commit
53c98db711
1 changed files with 2 additions and 18 deletions
|
@ -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 {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue