Implement SetValueOptional for GstRc<T>

This commit is contained in:
Sebastian Dröge 2017-08-18 15:38:51 +03:00
parent 489e6dc456
commit 6c4ee55f27

View file

@ -434,6 +434,16 @@ impl<T: MiniObject + glib::StaticType> glib::value::SetValue for GstRc<T> {
}
}
impl<T: MiniObject + glib::StaticType> glib::value::SetValueOptional for GstRc<T> {
unsafe fn set_value_optional(v: &mut glib::Value, s: Option<&Self>) {
if let Some(s) = s {
gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, s.as_ptr() as gpointer);
} else {
gobject_ffi::g_value_set_boxed(v.to_glib_none_mut().0, ptr::null_mut());
}
}
}
impl<T: MiniObject + 'static> GlibPtrDefault for GstRc<T> {
type GlibType = *mut T::GstType;
}