Move optional taglist/entry_struct fields into the Redirect builder from the constructor

This commit is contained in:
Sebastian Dröge 2017-12-16 18:13:25 +02:00
parent 7bc1fce97d
commit 974e681a5d

View file

@ -337,13 +337,9 @@ impl GstRc<MessageRef> {
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn new_redirect<'a>( pub fn new_redirect<'a>(location: &'a str) -> RedirectBuilder<'a> {
location: &'a str,
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,
) -> RedirectBuilder<'a> {
assert_initialized_main_thread!(); 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"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
impl<'a> RedirectBuilder<'a> { impl<'a> RedirectBuilder<'a> {
fn new( fn new(location: &'a str) -> Self {
location: &'a str,
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,
) -> Self {
skip_assert_initialized!(); skip_assert_initialized!();
Self { Self {
src: None, src: None,
seqnum: None, seqnum: None,
other_fields: Vec::new(), other_fields: Vec::new(),
location: location, location: location,
tag_list: tag_list, tag_list: None,
entry_struct: entry_struct, entry_struct: None,
entries: 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( pub fn entries(
self, self,
entries: &'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)], entries: &'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)],