From 1e18c59d2a1a35d997ea12280269641c257b0322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 16 Dec 2021 19:39:43 +0200 Subject: [PATCH] Implement glib::ValueTypeOptional for various types --- gstreamer-video/src/video_time_code.rs | 2 ++ gstreamer-video/src/video_time_code_interval.rs | 2 ++ gstreamer/src/caps_features.rs | 2 ++ gstreamer/src/iterator.rs | 2 ++ gstreamer/src/miniobject.rs | 2 ++ gstreamer/src/structure.rs | 2 ++ 6 files changed, 12 insertions(+) diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 6a3a9a660..a46807dfa 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -444,6 +444,8 @@ macro_rules! generic_impl { type Type = Self; } + impl glib::value::ValueTypeOptional for $name {} + #[doc(hidden)] unsafe impl<'a> glib::value::FromValue<'a> for $name { type Checker = glib::value::GenericValueTypeOrNoneChecker; diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 697a0c379..0f88497ca 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -210,6 +210,8 @@ impl glib::value::ValueType for VideoTimeCodeInterval { type Type = Self; } +impl glib::value::ValueTypeOptional for VideoTimeCodeInterval {} + #[doc(hidden)] unsafe impl<'a> glib::value::FromValue<'a> for VideoTimeCodeInterval { type Checker = glib::value::GenericValueTypeOrNoneChecker; diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 44af326ea..d50bf101e 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -235,6 +235,8 @@ impl glib::value::ValueType for CapsFeatures { type Type = Self; } +impl glib::value::ValueTypeOptional for CapsFeatures {} + unsafe impl<'a> glib::value::FromValue<'a> for CapsFeatures { type Checker = glib::value::GenericValueTypeOrNoneChecker; diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 814c2c1f9..b059b8de1 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -502,6 +502,8 @@ impl glib::value::ValueType for Iterator { type Type = Self; } +impl glib::value::ValueTypeOptional for Iterator {} + unsafe impl<'a, T: StaticType + 'static> glib::value::FromValue<'a> for Iterator { type Checker = glib::value::GenericValueTypeOrNoneChecker; diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 6cf41614a..71d190674 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -462,6 +462,8 @@ macro_rules! mini_object_wrapper ( type Type = Self; } + impl glib::value::ValueTypeOptional for $name { } + unsafe impl<'a> $crate::glib::value::FromValue<'a> for $name { type Checker = $crate::glib::value::GenericValueTypeOrNoneChecker; diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index cb39ab661..0b1286941 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -306,6 +306,8 @@ impl glib::value::ValueType for Structure { type Type = Self; } +impl glib::value::ValueTypeOptional for Structure {} + unsafe impl<'a> glib::value::FromValue<'a> for Structure { type Checker = glib::value::GenericValueTypeOrNoneChecker;