From 6c4ee55f27b8ed507a96b1e3236b735e926778d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 18 Aug 2017 15:38:51 +0300 Subject: [PATCH] Implement SetValueOptional for GstRc --- gstreamer/src/miniobject.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index df4ca89c6..cb9b94f9c 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -434,6 +434,16 @@ impl glib::value::SetValue for GstRc { } } +impl glib::value::SetValueOptional for GstRc { + 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 GlibPtrDefault for GstRc { type GlibType = *mut T::GstType; }