Implement Eq for all types
This commit is contained in:
@@ -93,7 +93,6 @@ extern {
|
||||
|
||||
//fn CFCopyDescription
|
||||
//fn CFCopyTypeIDDescription
|
||||
//fn CFEqual
|
||||
//fn CFGetAllocator
|
||||
pub fn CFEqual(cf1: CFTypeRef, cf2: CFTypeRef) -> Boolean;
|
||||
pub fn CFGetRetainCount(cf: CFTypeRef) -> CFIndex;
|
||||
|
||||
@@ -38,6 +38,15 @@ impl Clone for CFType {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for CFType {
|
||||
#[inline]
|
||||
fn eq(&self, other: &CFType) -> bool {
|
||||
unsafe {
|
||||
CFEqual(self.as_CFTypeRef(), other.as_CFTypeRef()) != 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for CFType {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
||||
@@ -45,6 +45,15 @@ macro_rules! impl_TCFType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for $ty {
|
||||
#[inline]
|
||||
fn eq(&self, other: &$ty) -> bool {
|
||||
self.as_CFType().eq(&other.as_CFType())
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for $ty { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user