mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-04-16 04:44:06 +00:00
vulkan/handle: Allow passing borrows of slices as mutable pointers
This commit is contained in:
parent
98aed74afc
commit
93dcb3e934
1 changed files with 33 additions and 7 deletions
|
@ -20,28 +20,54 @@ pub type VulkanHandleTypedef = GstVulkanHandleTypedef;
|
|||
// }
|
||||
// }
|
||||
|
||||
impl<'a> ToGlibContainerFromSlice<'a, *const *mut GstVulkanHandle> for &'a VulkanHandle {
|
||||
// impl<'a> ToGlibContainerFromSlice<'a, *const *mut GstVulkanHandle> for &'a VulkanHandle {
|
||||
// type Storage = &'a [Self];
|
||||
|
||||
// fn to_glib_none_from_slice(t: Self::Storage) -> (*const *mut GstVulkanHandle, Self::Storage) {
|
||||
// skip_assert_initialized!();
|
||||
// assert_eq!(
|
||||
// std::mem::size_of::<Self>(),
|
||||
// std::mem::size_of::<*mut GstVulkanHandle>()
|
||||
// );
|
||||
// let t_ptrs: &[*mut GstVulkanHandle] = unsafe { std::mem::transmute(t) };
|
||||
// (t_ptrs.as_ptr(), t)
|
||||
// }
|
||||
|
||||
// fn to_glib_container_from_slice(
|
||||
// _t: Self::Storage,
|
||||
// ) -> (*const *mut GstVulkanHandle, Self::Storage) {
|
||||
// skip_assert_initialized!();
|
||||
// unimplemented!("Consumer can't free *const pointer")
|
||||
// }
|
||||
|
||||
// fn to_glib_full_from_slice(_t: &[Self]) -> *const *mut GstVulkanHandle {
|
||||
// skip_assert_initialized!();
|
||||
// unimplemented!("Consumer can't free *const pointer")
|
||||
// }
|
||||
// }
|
||||
|
||||
impl<'a> ToGlibContainerFromSlice<'a, *mut *mut GstVulkanHandle> for &'a VulkanHandle {
|
||||
type Storage = &'a [Self];
|
||||
|
||||
fn to_glib_none_from_slice(t: Self::Storage) -> (*const *mut GstVulkanHandle, Self::Storage) {
|
||||
fn to_glib_none_from_slice(t: Self::Storage) -> (*mut *mut GstVulkanHandle, Self::Storage) {
|
||||
skip_assert_initialized!();
|
||||
assert_eq!(
|
||||
std::mem::size_of::<Self>(),
|
||||
std::mem::size_of::<*mut GstVulkanHandle>()
|
||||
);
|
||||
let t_ptrs: &[*mut GstVulkanHandle] = unsafe { std::mem::transmute(t) };
|
||||
(t_ptrs.as_ptr(), t)
|
||||
(t_ptrs.as_ptr().cast_mut(), t)
|
||||
}
|
||||
|
||||
fn to_glib_container_from_slice(
|
||||
_t: Self::Storage,
|
||||
) -> (*const *mut GstVulkanHandle, Self::Storage) {
|
||||
) -> (*mut *mut GstVulkanHandle, Self::Storage) {
|
||||
skip_assert_initialized!();
|
||||
unimplemented!("Consumer can't free *const pointer")
|
||||
unimplemented!("Consumer can't free *mut pointer")
|
||||
}
|
||||
|
||||
fn to_glib_full_from_slice(_t: &[Self]) -> *const *mut GstVulkanHandle {
|
||||
fn to_glib_full_from_slice(_t: &[Self]) -> *mut *mut GstVulkanHandle {
|
||||
skip_assert_initialized!();
|
||||
unimplemented!("Consumer can't free *const pointer")
|
||||
unimplemented!("Consumer can't free *mut pointer")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue