Remove some more boilerplate

This commit is contained in:
Sebastian Dröge 2017-09-25 15:35:27 +03:00
parent b25e612458
commit 5e9f42e7f8
4 changed files with 5 additions and 10 deletions

View file

@ -111,9 +111,7 @@ unsafe impl<T: IsA<gst_base::BaseSink>> BaseSink for T {}
pub type RsBaseSinkClass = ClassStruct<RsBaseSink>;
// FIXME: Boilerplate
unsafe impl BaseSinkClass<RsBaseSink> for gst_base_ffi::GstBaseSinkClass {}
unsafe impl BaseSinkClass<RsBaseSink> for RsBaseSinkClass {}
unsafe impl ElementClass<RsBaseSink> for gst_base_ffi::GstBaseSinkClass {}
unsafe impl ElementClass<RsBaseSink> for RsBaseSinkClass {}
#[macro_export]
@ -162,7 +160,7 @@ impl ObjectType for RsBaseSink {
unsafe { from_glib(gst_base_ffi::gst_base_sink_get_type()) }
}
fn class_init(klass: &mut Self::GlibClassType) {
fn class_init(klass: &mut RsBaseSinkClass) {
ElementClass::override_vfuncs(klass);
BaseSinkClass::override_vfuncs(klass);
}

View file

@ -147,9 +147,7 @@ unsafe impl<T: IsA<gst_base::BaseSrc>> BaseSrc for T {}
pub type RsBaseSrcClass = ClassStruct<RsBaseSrc>;
// FIXME: Boilerplate
unsafe impl BaseSrcClass<RsBaseSrc> for gst_base_ffi::GstBaseSrcClass {}
unsafe impl BaseSrcClass<RsBaseSrc> for RsBaseSrcClass {}
unsafe impl ElementClass<RsBaseSrc> for gst_base_ffi::GstBaseSrcClass {}
unsafe impl ElementClass<RsBaseSrc> for RsBaseSrcClass {}
#[macro_export]
@ -218,7 +216,7 @@ impl ObjectType for RsBaseSrc {
unsafe { from_glib(gst_base_ffi::gst_base_src_get_type()) }
}
fn class_init(klass: &mut Self::GlibClassType) {
fn class_init(klass: &mut RsBaseSrcClass) {
ElementClass::override_vfuncs(klass);
BaseSrcClass::override_vfuncs(klass);
}

View file

@ -117,7 +117,6 @@ pub type RsElementClass = ClassStruct<RsElement>;
// FIXME: Boilerplate
unsafe impl ElementClass<RsElement> for RsElementClass {}
unsafe impl ElementClass<RsElement> for gst_ffi::GstElementClass {}
#[macro_export]
macro_rules! box_element_impl(
@ -150,7 +149,7 @@ impl ObjectType for RsElement {
unsafe { from_glib(gst_ffi::gst_element_get_type()) }
}
fn class_init(klass: &mut Self::GlibClassType) {
fn class_init(klass: &mut RsElementClass) {
klass.override_vfuncs();
}
}

View file

@ -74,7 +74,7 @@ where
fn glib_type() -> glib::Type;
fn class_init(klass: &mut Self::GlibClassType);
fn class_init(klass: &mut ClassStruct<Self>);
fn set_property(_obj: &Self::RsType, _id: u32, _value: &glib::Value) {
unimplemented!()
@ -345,7 +345,7 @@ unsafe extern "C" fn class_init<T: ObjectType>(
gobject_klass.get_property = Some(get_property::<T>);
}
T::class_init(&mut *(klass as *mut T::GlibClassType));
T::class_init(&mut *(klass as *mut ClassStruct<T>));
}
unsafe extern "C" fn finalize<T: ObjectType>(obj: *mut gobject_ffi::GObject) {