Add MiniObject::from_glib_ptr_borrow()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1374>
This commit is contained in:
Sebastian Dröge 2024-01-05 22:29:43 +02:00
parent e35782a3a4
commit b5c7c402b9

View file

@ -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!();