mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-23 00:26:31 +00:00
gstreamer: meta: Add upcast_ref()
function to go from a specific to a generic meta
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1331>
This commit is contained in:
parent
16acea71d4
commit
a26fcaf0ad
1 changed files with 15 additions and 0 deletions
|
@ -212,6 +212,11 @@ impl<'a, T> MetaRef<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn upcast_ref(&self) -> &MetaRef<'a, Meta> {
|
||||
unsafe { &*(self as *const MetaRef<'a, T> as *const MetaRef<'a, Meta>) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn as_ptr(&self) -> *const T::GstType
|
||||
where
|
||||
|
@ -288,6 +293,16 @@ impl<'a, T, U> MetaRefMut<'a, T, U> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn upcast_ref(&self) -> &MetaRef<'a, Meta> {
|
||||
unsafe { &*(self as *const MetaRefMut<'a, T, U> as *const MetaRef<'a, Meta>) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn upcast_mut(&mut self) -> &MetaRefMut<'a, Meta, U> {
|
||||
unsafe { &mut *(self as *mut MetaRefMut<'a, T, U> as *mut MetaRefMut<'a, Meta, U>) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn as_ptr(&self) -> *const T::GstType
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue