mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-05 09:10:22 +00:00
gstreamer: add BufferRef::ptr_eq()
This commit is contained in:
parent
2dcd5cf9eb
commit
c0fd8a8aad
1 changed files with 17 additions and 0 deletions
|
@ -758,6 +758,13 @@ impl BufferRef {
|
|||
) -> Result<BufferRefCursor<&mut BufferRef>, glib::BoolError> {
|
||||
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(
|
||||
|
@ -1521,4 +1528,14 @@ mod tests {
|
|||
|
||||
assert_eq!(&[ClockTime::ZERO][..], &res[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ptr_eq() {
|
||||
crate::init().unwrap();
|
||||
|
||||
let buffer1 = Buffer::new();
|
||||
assert!(BufferRef::ptr_eq(&buffer1, &buffer1));
|
||||
let buffer2 = Buffer::new();
|
||||
assert!(!BufferRef::ptr_eq(&buffer1, &buffer2));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue