diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index 902905071..6b6c7d314 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -3,6 +3,7 @@ use std::cmp::Ordering; use std::ffi::CStr; use std::fmt; +use std::marker::PhantomData; use std::str; use glib::translate::{from_glib, from_glib_none, FromGlib, IntoGlib, ToGlibPtr, ToGlibPtrMut}; @@ -380,10 +381,10 @@ impl glib::translate::GlibPtrDefault for AudioFormatInfo { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstAudioFormatInfo> for AudioFormatInfo { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstAudioFormatInfo, Self> { - glib::translate::Stash(self.0, self) + glib::translate::Stash(self.0, PhantomData) } fn to_glib_full(&self) -> *const ffi::GstAudioFormatInfo { diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index d554f8ad9..4c6aed448 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -6,6 +6,7 @@ use glib::translate::{ use gst::prelude::*; use std::fmt; +use std::marker::PhantomData; use std::mem; use std::ptr; @@ -398,10 +399,10 @@ impl glib::translate::GlibPtrDefault for AudioInfo { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstAudioInfo> for AudioInfo { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstAudioInfo, Self> { - glib::translate::Stash(&self.0, self) + glib::translate::Stash(&self.0, PhantomData) } fn to_glib_full(&self) -> *const ffi::GstAudioInfo { diff --git a/gstreamer-base/src/base_parse_frame.rs b/gstreamer-base/src/base_parse_frame.rs index 9b3f9b022..c367d006b 100644 --- a/gstreamer-base/src/base_parse_frame.rs +++ b/gstreamer-base/src/base_parse_frame.rs @@ -51,10 +51,10 @@ impl FromGlib for Overhead { #[doc(hidden)] impl<'a> ::glib::translate::ToGlibPtr<'a, *mut ffi::GstBaseParseFrame> for BaseParseFrame<'a> { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> ::glib::translate::Stash<*mut ffi::GstBaseParseFrame, Self> { - Stash(self.0.as_ptr(), self) + Stash(self.0.as_ptr(), PhantomData) } fn to_glib_full(&self) -> *mut ffi::GstBaseParseFrame { diff --git a/gstreamer-rtsp-server/src/rtsp_context.rs b/gstreamer-rtsp-server/src/rtsp_context.rs index 86165b414..2e381ae40 100644 --- a/gstreamer-rtsp-server/src/rtsp_context.rs +++ b/gstreamer-rtsp-server/src/rtsp_context.rs @@ -1,6 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::*; +use std::marker::PhantomData; use std::ptr; #[derive(Debug, PartialEq, Eq)] @@ -34,10 +35,10 @@ impl FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext { #[doc(hidden)] impl<'a> ToGlibPtr<'a, *mut ffi::GstRTSPContext> for RTSPContext { - type Storage = &'a RTSPContext; + type Storage = PhantomData<&'a RTSPContext>; fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GstRTSPContext, Self> { - Stash(self.0.as_ptr(), self) + Stash(self.0.as_ptr(), PhantomData) } fn to_glib_full(&self) -> *mut ffi::GstRTSPContext { diff --git a/gstreamer-video/src/video_buffer_pool.rs b/gstreamer-video/src/video_buffer_pool.rs index f2c35502a..6dfd04567 100644 --- a/gstreamer-video/src/video_buffer_pool.rs +++ b/gstreamer-video/src/video_buffer_pool.rs @@ -1,6 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. use std::ffi::CStr; +use std::marker::PhantomData; use std::mem; use glib::translate::*; @@ -91,10 +92,10 @@ impl Eq for VideoAlignment {} #[doc(hidden)] impl<'a> ToGlibPtr<'a, *const ffi::GstVideoAlignment> for VideoAlignment { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> Stash<*const ffi::GstVideoAlignment, Self> { - Stash(&self.0, self) + Stash(&self.0, PhantomData) } } diff --git a/gstreamer-video/src/video_codec_frame.rs b/gstreamer-video/src/video_codec_frame.rs index 0851d02d6..a4d3c28c5 100644 --- a/gstreamer-video/src/video_codec_frame.rs +++ b/gstreamer-video/src/video_codec_frame.rs @@ -4,6 +4,7 @@ use crate::utils::HasStreamLock; use crate::VideoCodecFrameFlags; use glib::translate::*; use std::fmt; +use std::marker::PhantomData; use std::mem; pub struct VideoCodecFrame<'a> { @@ -15,10 +16,10 @@ pub struct VideoCodecFrame<'a> { #[doc(hidden)] impl<'a> ::glib::translate::ToGlibPtr<'a, *mut ffi::GstVideoCodecFrame> for VideoCodecFrame<'a> { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> ::glib::translate::Stash<'a, *mut ffi::GstVideoCodecFrame, Self> { - Stash(self.frame, self) + Stash(self.frame, PhantomData) } fn to_glib_full(&self) -> *mut ffi::GstVideoCodecFrame { diff --git a/gstreamer-video/src/video_format_info.rs b/gstreamer-video/src/video_format_info.rs index 9a56caa5a..03d751653 100644 --- a/gstreamer-video/src/video_format_info.rs +++ b/gstreamer-video/src/video_format_info.rs @@ -3,6 +3,7 @@ use std::cmp::Ordering; use std::ffi::CStr; use std::fmt; +use std::marker::PhantomData; use std::str; use glib::translate::{from_glib, IntoGlib, ToGlibPtr}; @@ -513,10 +514,10 @@ impl glib::translate::GlibPtrDefault for VideoFormatInfo { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoFormatInfo> for VideoFormatInfo { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstVideoFormatInfo, Self> { - glib::translate::Stash(self.0, self) + glib::translate::Stash(self.0, PhantomData) } fn to_glib_full(&self) -> *const ffi::GstVideoFormatInfo { diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index e1efa3815..02ce2ee6d 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -4,6 +4,7 @@ use glib::translate::*; use gst::prelude::*; use std::fmt; +use std::marker::PhantomData; use std::mem; use std::ptr; use std::str; @@ -921,10 +922,10 @@ impl glib::translate::GlibPtrDefault for VideoInfo { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstVideoInfo> for VideoInfo { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstVideoInfo, Self> { - glib::translate::Stash(&self.0, self) + glib::translate::Stash(&self.0, PhantomData) } fn to_glib_full(&self) -> *const ffi::GstVideoInfo { diff --git a/gstreamer-video/src/video_rectangle.rs b/gstreamer-video/src/video_rectangle.rs index f5a6dd90c..a4a7aba0a 100644 --- a/gstreamer-video/src/video_rectangle.rs +++ b/gstreamer-video/src/video_rectangle.rs @@ -1,6 +1,7 @@ // Take a look at the license at the top of the repository in the LICENSE file. use glib::translate::IntoGlib; +use std::marker::PhantomData; use std::mem; #[repr(C)] @@ -58,11 +59,11 @@ impl glib::translate::Uninitialized for VideoRectangle { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstVideoRectangle> for VideoRectangle { - type Storage = &'a mut Self; + type Storage = PhantomData<&'a mut Self>; fn to_glib_none_mut( &'a mut self, ) -> glib::translate::StashMut<*mut ffi::GstVideoRectangle, Self> { - glib::translate::StashMut(self as *mut _ as *mut _, self) + glib::translate::StashMut(self as *mut _ as *mut _, PhantomData) } } diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 31c265668..1909e3da8 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -4,6 +4,7 @@ use glib::translate::*; use gst::prelude::*; use std::cmp; use std::fmt; +use std::marker::PhantomData; use std::mem; use std::ptr; use std::str; @@ -352,11 +353,11 @@ macro_rules! generic_impl { #[doc(hidden)] impl<'a> ToGlibPtr<'a, *const ffi::GstVideoTimeCode> for $name { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; #[inline] fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstVideoTimeCode, Self> { - Stash(&self.0 as *const _, self) + Stash(&self.0 as *const _, PhantomData) } #[inline] @@ -367,12 +368,12 @@ macro_rules! generic_impl { #[doc(hidden)] impl<'a> ToGlibPtrMut<'a, *mut ffi::GstVideoTimeCode> for $name { - type Storage = &'a mut Self; + type Storage = PhantomData<&'a mut Self>; #[inline] fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::GstVideoTimeCode, Self> { let ptr = &mut self.0 as *mut _; - StashMut(ptr, self) + StashMut(ptr, PhantomData) } } diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index e0010da40..de1f637c5 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -4,6 +4,7 @@ use glib::prelude::*; use glib::translate::*; use std::cmp; use std::fmt; +use std::marker::PhantomData; use std::mem; use std::ptr; use std::str; @@ -137,11 +138,11 @@ impl GlibPtrDefault for VideoTimeCodeInterval { #[doc(hidden)] impl<'a> ToGlibPtr<'a, *const ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; #[inline] fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstVideoTimeCodeInterval, Self> { - Stash(&self.0 as *const _, self) + Stash(&self.0 as *const _, PhantomData) } #[inline] @@ -152,12 +153,12 @@ impl<'a> ToGlibPtr<'a, *const ffi::GstVideoTimeCodeInterval> for VideoTimeCodeIn #[doc(hidden)] impl<'a> ToGlibPtrMut<'a, *mut ffi::GstVideoTimeCodeInterval> for VideoTimeCodeInterval { - type Storage = &'a mut Self; + type Storage = PhantomData<&'a mut Self>; #[inline] fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::GstVideoTimeCodeInterval, Self> { let ptr = &mut self.0 as *mut _; - StashMut(ptr, self) + StashMut(ptr, PhantomData) } } diff --git a/gstreamer/src/allocation_params.rs b/gstreamer/src/allocation_params.rs index 2be8a3398..0db9fb1f6 100644 --- a/gstreamer/src/allocation_params.rs +++ b/gstreamer/src/allocation_params.rs @@ -1,5 +1,6 @@ // Take a look at the license at the top of the repository in the LICENSE file. +use std::marker::PhantomData; use std::mem; use glib::translate::*; @@ -64,10 +65,10 @@ impl From for AllocationParams { #[doc(hidden)] impl<'a> ToGlibPtr<'a, *const ffi::GstAllocationParams> for AllocationParams { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstAllocationParams, Self> { - Stash(&self.0, self) + Stash(&self.0, PhantomData) } } diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index ccf4eaa70..79bb17ee6 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -9,6 +9,7 @@ use crate::StructureRef; use glib::prelude::*; use glib::translate::*; +use std::marker::PhantomData; use std::mem; use std::ops; use std::ops::Deref; @@ -306,23 +307,23 @@ impl Eq for BufferPoolAcquireParams {} #[doc(hidden)] impl<'a> ToGlibPtr<'a, *const ffi::GstBufferPoolAcquireParams> for BufferPoolAcquireParams { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none( &'a self, ) -> glib::translate::Stash<'a, *const ffi::GstBufferPoolAcquireParams, Self> { - glib::translate::Stash(&self.0, self) + glib::translate::Stash(&self.0, PhantomData) } } #[doc(hidden)] impl<'a> ToGlibPtrMut<'a, *mut ffi::GstBufferPoolAcquireParams> for BufferPoolAcquireParams { - type Storage = &'a mut Self; + type Storage = PhantomData<&'a mut Self>; fn to_glib_none_mut( &'a mut self, ) -> glib::translate::StashMut<'a, *mut ffi::GstBufferPoolAcquireParams, Self> { - glib::translate::StashMut(&mut self.0, self) + glib::translate::StashMut(&mut self.0, PhantomData) } } diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 6d4a7f752..a0fe1d319 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -3,6 +3,7 @@ use std::borrow::{Borrow, BorrowMut, ToOwned}; use std::ffi::CStr; use std::fmt; +use std::marker::PhantomData; use std::mem; use std::ops::{Deref, DerefMut}; use std::ptr; @@ -164,10 +165,10 @@ impl glib::types::StaticType for CapsFeatures { } impl<'a> ToGlibPtr<'a, *const ffi::GstCapsFeatures> for CapsFeatures { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstCapsFeatures, Self> { - unsafe { Stash(self.0.as_ref(), self) } + unsafe { Stash(self.0.as_ref(), PhantomData) } } fn to_glib_full(&self) -> *const ffi::GstCapsFeatures { @@ -176,13 +177,13 @@ impl<'a> ToGlibPtr<'a, *const ffi::GstCapsFeatures> for CapsFeatures { } impl<'a> ToGlibPtr<'a, *mut ffi::GstCapsFeatures> for CapsFeatures { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GstCapsFeatures, Self> { unsafe { Stash( self.0.as_ref() as *const ffi::GstCapsFeatures as *mut ffi::GstCapsFeatures, - self, + PhantomData, ) } } @@ -193,10 +194,10 @@ impl<'a> ToGlibPtr<'a, *mut ffi::GstCapsFeatures> for CapsFeatures { } impl<'a> ToGlibPtrMut<'a, *mut ffi::GstCapsFeatures> for CapsFeatures { - type Storage = &'a mut Self; + type Storage = PhantomData<&'a mut Self>; fn to_glib_none_mut(&'a mut self) -> StashMut<*mut ffi::GstCapsFeatures, Self> { - unsafe { StashMut(self.0.as_mut(), self) } + unsafe { StashMut(self.0.as_mut(), PhantomData) } } } diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 1605b9df3..9e43d5a07 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -570,10 +570,10 @@ impl glib::translate::GlibPtrDefault for Iterator { #[doc(hidden)] impl<'a, T: 'static> glib::translate::ToGlibPtr<'a, *const ffi::GstIterator> for Iterator { - type Storage = &'a Iterator; + type Storage = PhantomData<&'a Iterator>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstIterator, Self> { - glib::translate::Stash(self.iter.as_ptr(), self) + glib::translate::Stash(self.iter.as_ptr(), PhantomData) } fn to_glib_full(&self) -> *const ffi::GstIterator { @@ -583,13 +583,13 @@ impl<'a, T: 'static> glib::translate::ToGlibPtr<'a, *const ffi::GstIterator> for #[doc(hidden)] impl<'a, T: 'static> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstIterator> for Iterator { - type Storage = &'a mut Iterator; + type Storage = PhantomData<&'a mut Iterator>; #[inline] fn to_glib_none_mut( &'a mut self, ) -> glib::translate::StashMut<'a, *mut ffi::GstIterator, Self> { - glib::translate::StashMut(self.iter.as_ptr(), self) + glib::translate::StashMut(self.iter.as_ptr(), PhantomData) } } diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 6e78a05f0..3af6e2ea1 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -146,10 +146,10 @@ macro_rules! mini_object_wrapper ( } impl<'a> $crate::glib::translate::ToGlibPtr<'a, *const $ffi_name> for $name { - type Storage = &'a Self; + type Storage = std::marker::PhantomData<&'a Self>; fn to_glib_none(&'a self) -> $crate::glib::translate::Stash<'a, *const $ffi_name, Self> { - $crate::glib::translate::Stash( self.as_ptr() , self) + $crate::glib::translate::Stash(self.as_ptr(), std::marker::PhantomData) } fn to_glib_full(&self) -> *const $ffi_name { @@ -161,10 +161,10 @@ macro_rules! mini_object_wrapper ( } impl<'a> $crate::glib::translate::ToGlibPtr<'a, *mut $ffi_name> for $name { - type Storage = &'a Self; + type Storage = std::marker::PhantomData<&'a Self>; fn to_glib_none(&'a self) -> $crate::glib::translate::Stash<'a, *mut $ffi_name, Self> { - $crate::glib::translate::Stash( self.as_mut_ptr() , self) + $crate::glib::translate::Stash(self.as_mut_ptr(), std::marker::PhantomData) } fn to_glib_full(&self) -> *mut $ffi_name { @@ -176,11 +176,11 @@ macro_rules! mini_object_wrapper ( } impl<'a> $crate::glib::translate::ToGlibPtrMut<'a, *mut $ffi_name> for $name { - type Storage = &'a mut Self; + type Storage = std::marker::PhantomData<&'a mut Self>; fn to_glib_none_mut(&'a mut self) -> $crate::glib::translate::StashMut<*mut $ffi_name, Self> { self.make_mut(); - $crate::glib::translate::StashMut( self.as_mut_ptr() , self) + $crate::glib::translate::StashMut(self.as_mut_ptr(), std::marker::PhantomData) } } diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 40cf934ea..60a7f4617 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -660,10 +660,10 @@ impl glib::translate::GlibPtrDefault for FormattedSe impl<'a, T: FormattedValueIntrinsic> glib::translate::ToGlibPtr<'a, *const ffi::GstSegment> for FormattedSegment { - type Storage = &'a FormattedSegment; + type Storage = PhantomData<&'a FormattedSegment>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstSegment, Self> { - glib::translate::Stash(&self.0, self) + glib::translate::Stash(&self.0, PhantomData) } fn to_glib_full(&self) -> *const ffi::GstSegment { @@ -675,11 +675,11 @@ impl<'a, T: FormattedValueIntrinsic> glib::translate::ToGlibPtr<'a, *const ffi:: impl<'a, T: FormattedValueIntrinsic> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstSegment> for FormattedSegment { - type Storage = &'a mut FormattedSegment; + type Storage = PhantomData<&'a mut FormattedSegment>; #[inline] fn to_glib_none_mut(&'a mut self) -> glib::translate::StashMut<'a, *mut ffi::GstSegment, Self> { - glib::translate::StashMut(&mut self.0, self) + glib::translate::StashMut(&mut self.0, PhantomData) } } diff --git a/gstreamer/src/static_caps.rs b/gstreamer/src/static_caps.rs index 44e378c0f..5aab794e5 100644 --- a/gstreamer/src/static_caps.rs +++ b/gstreamer/src/static_caps.rs @@ -7,6 +7,7 @@ use glib::StaticType; use std::ffi::CStr; use std::fmt; +use std::marker::PhantomData; use std::ptr; #[doc(alias = "GstStaticCaps")] @@ -101,10 +102,10 @@ impl glib::translate::GlibPtrDefault for StaticCaps { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticCaps> for StaticCaps { - type Storage = &'a StaticCaps; + type Storage = PhantomData<&'a StaticCaps>; fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstStaticCaps, Self> { - glib::translate::Stash(self.0.as_ptr(), self) + glib::translate::Stash(self.0.as_ptr(), PhantomData) } fn to_glib_full(&self) -> *const ffi::GstStaticCaps { diff --git a/gstreamer/src/static_pad_template.rs b/gstreamer/src/static_pad_template.rs index b254a7c71..9b399953d 100644 --- a/gstreamer/src/static_pad_template.rs +++ b/gstreamer/src/static_pad_template.rs @@ -8,6 +8,7 @@ use glib::StaticType; use std::ffi::CStr; use std::fmt; +use std::marker::PhantomData; use std::ptr; #[doc(alias = "GstStaticPadTemplate")] @@ -132,12 +133,12 @@ impl glib::translate::GlibPtrDefault for StaticPadTemplate { #[doc(hidden)] impl<'a> glib::translate::ToGlibPtr<'a, *const ffi::GstStaticPadTemplate> for StaticPadTemplate { - type Storage = &'a StaticPadTemplate; + type Storage = PhantomData<&'a StaticPadTemplate>; fn to_glib_none( &'a self, ) -> glib::translate::Stash<'a, *const ffi::GstStaticPadTemplate, Self> { - glib::translate::Stash(self.0.as_ptr(), self) + glib::translate::Stash(self.0.as_ptr(), PhantomData) } fn to_glib_full(&self) -> *const ffi::GstStaticPadTemplate { diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 621bf3d2f..5aa9a9f26 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -3,6 +3,7 @@ use std::borrow::{Borrow, BorrowMut, ToOwned}; use std::ffi::CStr; use std::fmt; +use std::marker::PhantomData; use std::mem; use std::ops::{Deref, DerefMut}; use std::ptr; @@ -219,10 +220,10 @@ impl glib::types::StaticType for Structure { } impl<'a> ToGlibPtr<'a, *const ffi::GstStructure> for Structure { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GstStructure, Self> { - unsafe { Stash(self.0.as_ref(), self) } + unsafe { Stash(self.0.as_ref(), PhantomData) } } fn to_glib_full(&self) -> *const ffi::GstStructure { @@ -231,13 +232,13 @@ impl<'a> ToGlibPtr<'a, *const ffi::GstStructure> for Structure { } impl<'a> ToGlibPtr<'a, *mut ffi::GstStructure> for Structure { - type Storage = &'a Self; + type Storage = PhantomData<&'a Self>; fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GstStructure, Self> { unsafe { Stash( self.0.as_ref() as *const ffi::GstStructure as *mut ffi::GstStructure, - self, + PhantomData, ) } } @@ -248,10 +249,10 @@ impl<'a> ToGlibPtr<'a, *mut ffi::GstStructure> for Structure { } impl<'a> ToGlibPtrMut<'a, *mut ffi::GstStructure> for Structure { - type Storage = &'a mut Self; + type Storage = PhantomData<&'a mut Self>; fn to_glib_none_mut(&'a mut self) -> StashMut<*mut ffi::GstStructure, Self> { - unsafe { StashMut(self.0.as_mut(), self) } + unsafe { StashMut(self.0.as_mut(), PhantomData) } } }