miniobject: implement ptr_eq() on ref type

This commit is contained in:
Guillaume Desmottes 2022-08-12 10:56:33 +02:00
parent c0fd8a8aad
commit c5d19e7c80
2 changed files with 5 additions and 7 deletions

View file

@ -758,13 +758,6 @@ impl BufferRef {
) -> Result<BufferRefCursor<&mut BufferRef>, glib::BoolError> { ) -> Result<BufferRefCursor<&mut BufferRef>, glib::BoolError> {
BufferRefCursor::new_writable(self) BufferRefCursor::new_writable(self)
} }
// rustdoc-stripper-ignore-next
/// Returns `true` if the two [`BufferRef`] point to the same buffer.
pub fn ptr_eq(this: &BufferRef, other: &BufferRef) -> bool {
skip_assert_initialized!();
this.as_ptr() == other.as_ptr()
}
} }
macro_rules! define_meta_iter( macro_rules! define_meta_iter(

View file

@ -431,6 +431,11 @@ macro_rules! mini_object_wrapper (
&mut *(self.as_mut_ptr() as *mut $crate::miniobject::MiniObjectRef) &mut *(self.as_mut_ptr() as *mut $crate::miniobject::MiniObjectRef)
} }
} }
pub fn ptr_eq(this: &$ref_name, other: &$ref_name) -> bool {
skip_assert_initialized!();
this.as_ptr() == other.as_ptr()
}
} }
impl $crate::glib::translate::GlibPtrDefault for $ref_name { impl $crate::glib::translate::GlibPtrDefault for $ref_name {