From 927b1ac8225c90573acb1055e30909286cc56e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 1 Dec 2017 16:08:12 +0200 Subject: [PATCH] Revert "Event/Message::get_structure() can return None" This reverts commit aa275d5ddbbf48a9f0aa7f3ae95c948dbfee3353. It actually breaks the API, we need to find another way. --- gstreamer/src/event.rs | 8 ++------ gstreamer/src/message.rs | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index f5a276610..5e8b9bbfe 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -101,14 +101,10 @@ impl EventRef { } - pub fn get_structure(&self) -> Option<&StructureRef> { + pub fn get_structure(&self) -> &StructureRef { unsafe { let structure = ffi::gst_event_get_structure(self.as_mut_ptr()); - if structure.is_null() { - None - } else { - Some(StructureRef::from_glib_borrow(structure)) - } + StructureRef::from_glib_borrow(structure) } } diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 37771c9d7..d4aa4437a 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -45,14 +45,10 @@ impl MessageRef { unsafe { ffi::gst_message_get_seqnum(self.as_mut_ptr()) } } - pub fn get_structure(&self) -> Option<&StructureRef> { + pub fn get_structure(&self) -> &StructureRef { unsafe { let structure = ffi::gst_message_get_structure(self.as_mut_ptr()); - if structure.is_null() { - None - } else { - Some(StructureRef::from_glib_borrow(structure)) - } + StructureRef::from_glib_borrow(structure) } }