From b5c7c402b93620aa0d9f7fff225fe5371775f72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 5 Jan 2024 22:29:43 +0200 Subject: [PATCH] Add `MiniObject::from_glib_ptr_borrow()` Part-of: --- gstreamer/src/miniobject.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index f9a28e7b5..c776ab52c 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -28,6 +28,13 @@ macro_rules! mini_object_wrapper ( } impl $name { + #[inline] + pub unsafe fn from_glib_ptr_borrow<'a>( + ptr: *const *const $ffi_name, + ) -> &'a Self { + &*(ptr as *const $name) + } + #[inline] pub unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self { skip_assert_initialized!();