From 974e681a5dba0d41e11966686ac3075747abe482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 16 Dec 2017 18:13:25 +0200 Subject: [PATCH] Move optional taglist/entry_struct fields into the Redirect builder from the constructor --- gstreamer/src/message.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 5523797ed..d392408cc 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -337,13 +337,9 @@ impl GstRc { } #[cfg(any(feature = "v1_10", feature = "dox"))] - pub fn new_redirect<'a>( - location: &'a str, - tag_list: Option<&'a TagList>, - entry_struct: Option, - ) -> RedirectBuilder<'a> { + pub fn new_redirect<'a>(location: &'a str) -> RedirectBuilder<'a> { assert_initialized_main_thread!(); - RedirectBuilder::new(location, tag_list, entry_struct) + RedirectBuilder::new(location) } } @@ -2396,23 +2392,33 @@ pub struct RedirectBuilder<'a> { } #[cfg(any(feature = "v1_10", feature = "dox"))] impl<'a> RedirectBuilder<'a> { - fn new( - location: &'a str, - tag_list: Option<&'a TagList>, - entry_struct: Option, - ) -> Self { + fn new(location: &'a str) -> Self { skip_assert_initialized!(); Self { src: None, seqnum: None, other_fields: Vec::new(), location: location, - tag_list: tag_list, - entry_struct: entry_struct, + tag_list: None, + entry_struct: None, entries: None, } } + pub fn tag_list(self, tag_list: &'a TagList) -> Self { + Self { + tag_list: Some(tag_list), + ..self + } + } + + pub fn entry_struct(self, entry_struct: Structure) -> Self { + Self { + entry_struct: Some(entry_struct), + ..self + } + } + pub fn entries( self, entries: &'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)],