Use impl for some Into* trait bounds

This commit is contained in:
Marijn Suijten 2021-09-21 23:54:11 +02:00
parent 669bf52291
commit 226419003d
4 changed files with 25 additions and 44 deletions

View file

@ -214,8 +214,8 @@ impl fmt::Debug for VideoOverlayCompositionRef {
impl VideoOverlayComposition { impl VideoOverlayComposition {
#[doc(alias = "gst_video_overlay_composition_new")] #[doc(alias = "gst_video_overlay_composition_new")]
pub fn new<'a, T: IntoIterator<Item = &'a VideoOverlayRectangle>>( pub fn new<'a>(
rects: T, rects: impl IntoIterator<Item = &'a VideoOverlayRectangle>,
) -> Result<Self, glib::error::BoolError> { ) -> Result<Self, glib::error::BoolError> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {

View file

@ -58,10 +58,7 @@ impl Caps {
} }
#[allow(clippy::should_implement_trait)] #[allow(clippy::should_implement_trait)]
pub fn from_iter<'a, I>(iter: I) -> Self pub fn from_iter<'a>(iter: impl IntoIterator<Item = &'a StructureRef>) -> Self {
where
I: IntoIterator<Item = &'a StructureRef>,
{
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let mut caps = Caps::new_empty(); let mut caps = Caps::new_empty();
@ -71,10 +68,9 @@ impl Caps {
caps caps
} }
pub fn from_iter_with_features<'a, 'b, I>(iter: I) -> Self pub fn from_iter_with_features<'a, 'b>(
where iter: impl IntoIterator<Item = (&'a StructureRef, &'b CapsFeaturesRef)>,
I: IntoIterator<Item = (&'a StructureRef, &'b CapsFeaturesRef)>, ) -> Self {
{
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let mut caps = Caps::new_empty(); let mut caps = Caps::new_empty();

View file

@ -109,22 +109,14 @@ fn validate(
impl DateTime { impl DateTime {
#[doc(alias = "gst_date_time_new")] #[doc(alias = "gst_date_time_new")]
pub fn new< pub fn new(
TZ: Into<Option<f32>>, tzoffset: impl Into<Option<f32>>,
Y: Into<i32>, year: impl Into<i32>,
MO: Into<Option<i32>>, month: impl Into<Option<i32>>,
D: Into<Option<i32>>, day: impl Into<Option<i32>>,
H: Into<Option<i32>>, hour: impl Into<Option<i32>>,
MI: Into<Option<i32>>, minute: impl Into<Option<i32>>,
S: Into<Option<f64>>, seconds: impl Into<Option<f64>>,
>(
tzoffset: TZ,
year: Y,
month: MO,
day: D,
hour: H,
minute: MI,
seconds: S,
) -> Result<DateTime, glib::BoolError> { ) -> Result<DateTime, glib::BoolError> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
@ -153,20 +145,13 @@ impl DateTime {
} }
#[doc(alias = "gst_date_time_new_local_time")] #[doc(alias = "gst_date_time_new_local_time")]
pub fn new_local_time< pub fn new_local_time(
Y: Into<i32>, year: impl Into<i32>,
MO: Into<Option<i32>>, month: impl Into<Option<i32>>,
D: Into<Option<i32>>, day: impl Into<Option<i32>>,
H: Into<Option<i32>>, hour: impl Into<Option<i32>>,
MI: Into<Option<i32>>, minute: impl Into<Option<i32>>,
S: Into<Option<f64>>, seconds: impl Into<Option<f64>>,
>(
year: Y,
month: MO,
day: D,
hour: H,
minute: MI,
seconds: S,
) -> Result<DateTime, glib::BoolError> { ) -> Result<DateTime, glib::BoolError> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();

View file

@ -100,10 +100,10 @@ impl Structure {
} }
#[allow(clippy::should_implement_trait)] #[allow(clippy::should_implement_trait)]
pub fn from_iter<'a, 'b, I>(name: &str, iter: I) -> Structure pub fn from_iter<'a, 'b>(
where name: &str,
I: IntoIterator<Item = (&'a str, &'b SendValue)>, iter: impl IntoIterator<Item = (&'a str, &'b SendValue)>,
{ ) -> Structure {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let mut structure = Structure::new_empty(name); let mut structure = Structure::new_empty(name);