mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-12 19:29:24 +00:00
Add Eq/PartialEq instances for TagList and Caps
This commit is contained in:
parent
1ee7c8b9e3
commit
2ec438e5b8
|
@ -21,7 +21,9 @@ use std::ffi::CString;
|
|||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use value::*;
|
||||
use utils::*;
|
||||
|
||||
#[derive(Eq)]
|
||||
pub struct Caps(*mut c_void);
|
||||
|
||||
impl Caps {
|
||||
|
@ -163,6 +165,16 @@ impl fmt::Debug for Caps {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Caps {
|
||||
fn eq(&self, other: &Caps) -> bool {
|
||||
extern "C" {
|
||||
fn gst_caps_is_equal(a: *const c_void, b: *const c_void) -> GBoolean;
|
||||
}
|
||||
|
||||
unsafe { gst_caps_is_equal(self.0, other.0).to_bool() }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
@ -62,6 +62,7 @@ pub enum MergeMode {
|
|||
KeepAll,
|
||||
}
|
||||
|
||||
#[derive(Eq)]
|
||||
pub struct TagList(*mut c_void);
|
||||
|
||||
impl TagList {
|
||||
|
@ -193,6 +194,16 @@ impl fmt::Debug for TagList {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq for TagList {
|
||||
fn eq(&self, other: &TagList) -> bool {
|
||||
extern "C" {
|
||||
fn gst_tag_list_is_equal(a: *const c_void, b: *const c_void) -> GBoolean;
|
||||
}
|
||||
|
||||
unsafe { gst_tag_list_is_equal(self.0, other.0).to_bool() }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue