From 03f928ee0c274922f1872eba57b21bd1daa0d467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 23 Dec 2020 10:31:49 +0200 Subject: [PATCH] gstreamer/serde: Update for glib::Date API changes --- gstreamer/src/date_time_serde.rs | 2 +- gstreamer/src/structure_serde.rs | 6 +++--- gstreamer/src/tags_serde.rs | 8 ++++---- gstreamer/src/value_serde.rs | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index d50315340..6d7d78f06 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -123,7 +123,7 @@ impl TryFrom for Date { month, y.try_into() .map_err(|_| glib::bool_error!("Out of range `year` for `Date`"))?, - ))) + )?)) } _ => Err(glib::bool_error!( "Incompatible variant for `Date` (expecting \"YMD\")" diff --git a/gstreamer/src/structure_serde.rs b/gstreamer/src/structure_serde.rs index 45a8e7e59..6d774371e 100644 --- a/gstreamer/src/structure_serde.rs +++ b/gstreamer/src/structure_serde.rs @@ -178,7 +178,7 @@ mod tests { .field("f2", &String::from("bcd")) .field("f3", &123i32) .field("fraction", &Fraction::new(1, 2)) - .field("date", &Date::new_dmy(19, DateMonth::August, 2019)) + .field("date", &Date::new_dmy(19, DateMonth::August, 2019).unwrap()) .field( "date_time", &DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(), @@ -236,7 +236,7 @@ mod tests { ("f1", &"abc"), ("f2", &"bcd"), ("f3", &123), - ("date", &Date::new_dmy(19, DateMonth::August, 2019)), + ("date", &Date::new_dmy(19, DateMonth::August, 2019).unwrap()), ( "date_time", &DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap() @@ -258,7 +258,7 @@ mod tests { .field("f2", &"bcd".to_owned()) .field("f3", &123i32) .field("fraction", &Fraction::new(1, 2)) - .field("date", &Date::new_dmy(19, DateMonth::August, 2019)) + .field("date", &Date::new_dmy(19, DateMonth::August, 2019).unwrap()) .field( "date_time", &DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(), diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index ede4763dc..8e12dfacd 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -341,7 +341,7 @@ mod tests { tags.add::(&96_000, TagMergeMode::Append); // u32 tags.add::(&1f64, TagMergeMode::Append); // f64 tags.add::( - &glib::Date::new_dmy(28, glib::DateMonth::May, 2018), + &glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap(), TagMergeMode::Append, ); tags.add::( @@ -491,7 +491,7 @@ mod tests { ); assert_eq!( tags.get_index::(0).unwrap().get().unwrap(), - glib::Date::new_dmy(28, glib::DateMonth::May, 2018) + glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap() ); assert_eq!( tags.get_index::(0).unwrap().get().unwrap(), @@ -532,7 +532,7 @@ mod tests { ); assert_eq!( tags.get_index::(0).unwrap().get().unwrap(), - glib::Date::new_dmy(28, glib::DateMonth::May, 2018) + glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap() ); assert_eq!( tags.get_index::(0).unwrap().get().unwrap(), @@ -561,7 +561,7 @@ mod tests { tags.add::(&96_000, TagMergeMode::Append); // u32 tags.add::(&1f64, TagMergeMode::Append); // f64 tags.add::( - &glib::Date::new_dmy(28, glib::DateMonth::May, 2018), + &glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap(), TagMergeMode::Append, ); tags.add::( diff --git a/gstreamer/src/value_serde.rs b/gstreamer/src/value_serde.rs index ff3ba4fc7..8975e46e2 100644 --- a/gstreamer/src/value_serde.rs +++ b/gstreamer/src/value_serde.rs @@ -364,7 +364,7 @@ mod tests { let value_12 = Fraction::new(1, 2); let value_str = "test str"; let value_str_none: Option<&str> = None; - let value_date = Date::new_dmy(19, DateMonth::August, 2019); + let value_date = Date::new_dmy(19, DateMonth::August, 2019).unwrap(); let value_date_none: Option = None; let array = Array::new(&[ @@ -555,7 +555,7 @@ mod tests { assert!(slice[3].get::().expect("slice[3]").is_none()); assert_eq!( - Date::new_dmy(19, DateMonth::August, 2019), + Date::new_dmy(19, DateMonth::August, 2019).unwrap(), slice[4].get::().expect("slice[4]").unwrap() ); @@ -582,7 +582,7 @@ mod tests { assert!(slice[3].get::().expect("slice[3]").is_none()); assert_eq!( - Date::new_dmy(19, DateMonth::August, 2019), + Date::new_dmy(19, DateMonth::August, 2019).unwrap(), slice[4].get::().expect("slice[4]").unwrap() ); @@ -628,7 +628,7 @@ mod tests { let value_12 = Fraction::new(1, 2); let value_str = "test str"; let value_str_none: Option<&str> = None; - let value_date = Date::new_dmy(19, DateMonth::August, 2019); + let value_date = Date::new_dmy(19, DateMonth::August, 2019).unwrap(); let value_date_none: Option = None; let array = Array::new(&[