Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-04-28 16:13:43 +0300
committerSebastian Dröge <sebastian@centricular.com>2018-05-01 17:11:18 +0300
commita401427a0ca64835e38c8db1f495e49702baab20 (patch)
tree305a900f7658a2a77b166c8c7337d1be44cb4191
parent31a48c4baad7d1daf45971bd069d613870af3df9 (diff)
add Instance trait implementation for InstanceStruct
-rw-r--r--gobject-subclass/src/object.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/gobject-subclass/src/object.rs b/gobject-subclass/src/object.rs
index 6578b7164..7f4c9c1a8 100644
--- a/gobject-subclass/src/object.rs
+++ b/gobject-subclass/src/object.rs
@@ -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,