mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-23 01:18:11 +00:00
add Instance trait implementation for InstanceStruct
This commit is contained in:
parent
31a48c4baa
commit
a401427a0c
1 changed files with 19 additions and 0 deletions
|
@ -135,6 +135,25 @@ pub struct InstanceStruct<T: ObjectType>
|
|||
}
|
||||
|
||||
|
||||
impl<T: ObjectType> Instance<T> for InstanceStruct<T>
|
||||
{
|
||||
fn parent(&self) -> &T::GlibType{
|
||||
&self._parent
|
||||
}
|
||||
|
||||
fn get_impl(&self) -> &T::ImplType {
|
||||
unsafe { self._imp.as_ref() }
|
||||
}
|
||||
|
||||
unsafe fn set_impl(&mut self, imp:ptr::NonNull<T::ImplType>){
|
||||
self._imp = imp;
|
||||
}
|
||||
|
||||
unsafe fn get_class(&self) -> *const ClassStruct<T> {
|
||||
*(self as *const _ as *const *const ClassStruct<T>)
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct ClassStruct<T: ObjectType> {
|
||||
pub parent: T::GlibClassType,
|
||||
|
|
Loading…
Reference in a new issue