From 2a74d32774066d91948b32582f913a8c437e2c70 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 19 Jan 2022 15:22:27 +0100 Subject: [PATCH] make use of impl T wherever possible Except in ClosureExpression because we can't mix both impl & generic types due to https://github.com/rust-lang/rust/issues/83701 --- gdk4/src/clipboard.rs | 32 +++++--------- gdk4/src/drop.rs | 14 ++---- gdk4/src/event.rs | 6 +-- gdk4/src/functions.rs | 28 +++++------- gtk4/src/builder.rs | 4 +- gtk4/src/cell_area.rs | 62 ++++++++++++--------------- gtk4/src/cell_editable.rs | 4 +- gtk4/src/cell_renderer.rs | 24 +++++------ gtk4/src/closure_expression.rs | 7 ++- gtk4/src/directory_list.rs | 2 +- gtk4/src/expression.rs | 2 +- gtk4/src/file_chooser_dialog.rs | 4 +- gtk4/src/im_context.rs | 4 +- gtk4/src/im_context_simple.rs | 2 +- gtk4/src/map_list_model.rs | 2 +- gtk4/src/message_dialog.rs | 8 ++-- gtk4/src/notebook.rs | 76 ++++++++++++++------------------- gtk4/src/shortcut_trigger.rs | 8 ++-- gtk4/src/text_view.rs | 4 +- gtk4/src/tree_model_filter.rs | 2 +- gtk4/src/tree_row_reference.rs | 4 +- gtk4/src/tree_view_column.rs | 2 +- 22 files changed, 126 insertions(+), 175 deletions(-) diff --git a/gdk4/src/clipboard.rs b/gdk4/src/clipboard.rs index 4787e08d819f..49d8be7bef60 100644 --- a/gdk4/src/clipboard.rs +++ b/gdk4/src/clipboard.rs @@ -10,14 +10,11 @@ use std::ptr; impl Clipboard { #[doc(alias = "gdk_clipboard_read_async")] - pub fn read_async< - P: IsA, - Q: FnOnce(Result<(gio::InputStream, GString), glib::Error>) + 'static, - >( + pub fn read_async) + 'static>( &self, mime_types: &[&str], io_priority: glib::Priority, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); @@ -89,10 +86,10 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_store_async")] - pub fn store_async, Q: FnOnce(Result<(), glib::Error>) + 'static>( + pub fn store_async) + 'static>( &self, io_priority: glib::Priority, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); @@ -137,14 +134,11 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_read_value_async")] - pub fn read_value_async< - P: IsA, - Q: FnOnce(Result) + 'static, - >( + pub fn read_value_async) + 'static>( &self, type_: glib::types::Type, io_priority: glib::Priority, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); @@ -193,12 +187,9 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_read_text_async")] - pub fn read_text_async< - P: IsA, - Q: FnOnce(Result, glib::Error>) + 'static, - >( + pub fn read_text_async, glib::Error>) + 'static>( &self, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); @@ -244,12 +235,9 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_read_texture_async")] - pub fn read_texture_async< - P: IsA, - Q: FnOnce(Result, glib::Error>) + 'static, - >( + pub fn read_texture_async, glib::Error>) + 'static>( &self, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); diff --git a/gdk4/src/drop.rs b/gdk4/src/drop.rs index 7f13d3e5db92..c73163d915e0 100644 --- a/gdk4/src/drop.rs +++ b/gdk4/src/drop.rs @@ -11,14 +11,11 @@ use std::ptr; impl Drop { #[doc(alias = "gdk_drop_read_async")] - pub fn read_async< - P: IsA, - Q: FnOnce(Result<(gio::InputStream, GString), glib::Error>) + 'static, - >( + pub fn read_async) + 'static>( &self, mime_types: &[&str], io_priority: glib::Priority, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); @@ -81,14 +78,11 @@ impl Drop { } #[doc(alias = "gdk_drop_read_value_async")] - pub fn read_value_async< - P: IsA, - Q: FnOnce(Result) + 'static, - >( + pub fn read_value_async) + 'static>( &self, type_: glib::types::Type, io_priority: glib::Priority, - cancellable: Option<&P>, + cancellable: Option<&impl IsA>, callback: Q, ) { let user_data: Box = Box::new(callback); diff --git a/gdk4/src/event.rs b/gdk4/src/event.rs index 02ca952efc76..8109c57d8107 100644 --- a/gdk4/src/event.rs +++ b/gdk4/src/event.rs @@ -29,7 +29,7 @@ impl Event { #[doc(alias = "gdk_events_get_angle")] #[doc(alias = "get_angle")] - pub fn angle>(&self, event: P) -> Option { + pub fn angle(&self, event: impl AsRef) -> Option { skip_assert_initialized!(); unsafe { let mut angle = mem::MaybeUninit::uninit(); @@ -49,7 +49,7 @@ impl Event { #[doc(alias = "gdk_events_get_center")] #[doc(alias = "get_center")] - pub fn center>(&self, event: P) -> Option<(f64, f64)> { + pub fn center(&self, event: impl AsRef) -> Option<(f64, f64)> { skip_assert_initialized!(); unsafe { let mut x = mem::MaybeUninit::uninit(); @@ -72,7 +72,7 @@ impl Event { #[doc(alias = "gdk_events_get_distance")] #[doc(alias = "get_distance")] - pub fn distance>(&self, event: P) -> Option { + pub fn distance(&self, event: impl AsRef) -> Option { skip_assert_initialized!(); unsafe { let mut distance = mem::MaybeUninit::uninit(); diff --git a/gdk4/src/functions.rs b/gdk4/src/functions.rs index e223ff1764a7..f7f248591ccb 100644 --- a/gdk4/src/functions.rs +++ b/gdk4/src/functions.rs @@ -32,16 +32,12 @@ pub fn pango_layout_get_clip_region( } #[doc(alias = "gdk_content_deserialize_async")] -pub fn content_deserialize_async< - P: IsA, - Q: IsA, - R: FnOnce(Result) + Send + 'static, ->( - stream: &P, +pub fn content_deserialize_async) + Send + 'static>( + stream: &impl IsA, mime_type: &str, type_: glib::types::Type, io_priority: glib::Priority, - cancellable: Option<&Q>, + cancellable: Option<&impl IsA>, callback: R, ) { assert_initialized_main_thread!(); @@ -78,8 +74,8 @@ pub fn content_deserialize_async< } } -pub fn content_deserialize_future + Clone + 'static>( - stream: &P, +pub fn content_deserialize_future( + stream: &(impl IsA + Clone + 'static), mime_type: &str, type_: glib::types::Type, io_priority: glib::Priority, @@ -222,16 +218,12 @@ pub fn content_register_serializer< } #[doc(alias = "gdk_content_serialize_async")] -pub fn content_serialize_async< - P: IsA, - Q: IsA, - R: FnOnce(Result<(), glib::Error>) + Send + 'static, ->( - stream: &P, +pub fn content_serialize_async) + Send + 'static>( + stream: &impl IsA, mime_type: &str, value: &glib::Value, io_priority: glib::Priority, - cancellable: Option<&Q>, + cancellable: Option<&impl IsA>, callback: R, ) { assert_initialized_main_thread!(); @@ -267,8 +259,8 @@ pub fn content_serialize_async< } } -pub fn content_serialize_future + Clone + 'static>( - stream: &P, +pub fn content_serialize_future( + stream: &(impl IsA + Clone + 'static), mime_type: &str, value: &glib::Value, io_priority: glib::Priority, diff --git a/gtk4/src/builder.rs b/gtk4/src/builder.rs index 88d0b32e9a70..d230f0ea3749 100644 --- a/gtk4/src/builder.rs +++ b/gtk4/src/builder.rs @@ -9,7 +9,7 @@ use std::path::Path; impl Builder { #[doc(alias = "gtk_builder_new_from_file")] #[doc(alias = "new_from_file")] - pub fn from_file>(file_path: T) -> Self { + pub fn from_file(file_path: impl AsRef) -> Self { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_builder_new_from_file( @@ -45,7 +45,7 @@ impl Builder { } #[doc(alias = "gtk_builder_add_from_file")] - pub fn add_from_file>(&self, file_path: T) -> Result<(), glib::Error> { + pub fn add_from_file(&self, file_path: impl AsRef) -> Result<(), glib::Error> { unsafe { let mut error = ::std::ptr::null_mut(); ffi::gtk_builder_add_from_file( diff --git a/gtk4/src/cell_area.rs b/gtk4/src/cell_area.rs index fdb528bfbe65..0202e57d023a 100644 --- a/gtk4/src/cell_area.rs +++ b/gtk4/src/cell_area.rs @@ -17,51 +17,43 @@ pub trait CellAreaExtManual { ); #[doc(alias = "gtk_cell_area_activate_cell")] - fn activate_cell, Q: IsA, R: AsRef>( + fn activate_cell( &self, - widget: &P, - renderer: &Q, - event: &R, + widget: &impl IsA, + renderer: &impl IsA, + event: &impl AsRef, cell_area: &gdk::Rectangle, flags: CellRendererState, ) -> bool; #[doc(alias = "gtk_cell_area_event")] - fn event, Q: IsA, R: AsRef>( + fn event( &self, - context: &P, - widget: &Q, - event: &R, + context: &impl IsA, + widget: &impl IsA, + event: &impl AsRef, cell_area: &gdk::Rectangle, flags: CellRendererState, ) -> i32; #[doc(alias = "gtk_cell_area_cell_get_valist")] #[doc(alias = "gtk_cell_area_cell_get_property")] - fn cell_get_value>( - &self, - renderer: &P, - property_name: &str, - ) -> glib::Value; + fn cell_get_value(&self, renderer: &impl IsA, property_name: &str) + -> glib::Value; // rustdoc-stripper-ignore-next /// Similar to [`Self::cell_get_value`] but panics if the value is of a different type. #[doc(alias = "gtk_cell_area_cell_get_valist")] #[doc(alias = "gtk_cell_area_cell_get_property")] - fn cell_get FromValue<'b> + 'static, P: IsA>( + fn cell_get FromValue<'b> + 'static>( &self, - renderer: &P, + renderer: &impl IsA, property_name: &str, ) -> V; #[doc(alias = "gtk_cell_area_cell_set_valist")] #[doc(alias = "gtk_cell_area_cell_set_property")] - fn cell_set>( - &self, - renderer: &P, - property_name: &str, - value: &dyn ToValue, - ); + fn cell_set(&self, renderer: &impl IsA, property_name: &str, value: &dyn ToValue); } impl> CellAreaExtManual for O { @@ -75,11 +67,11 @@ impl> CellAreaExtManual for O { self.as_ref().cell_set(renderer, property_name, *value); }); } - fn activate_cell, Q: IsA, R: AsRef>( + fn activate_cell( &self, - widget: &P, - renderer: &Q, - event: &R, + widget: &impl IsA, + renderer: &impl IsA, + event: &impl AsRef, cell_area: &gdk::Rectangle, flags: CellRendererState, ) -> bool { @@ -95,9 +87,9 @@ impl> CellAreaExtManual for O { } } - fn cell_get_value>( + fn cell_get_value( &self, - renderer: &P, + renderer: &impl IsA, property_name: &str, ) -> glib::Value { unsafe { @@ -121,9 +113,9 @@ impl> CellAreaExtManual for O { } } - fn cell_get FromValue<'b> + 'static, P: IsA>( + fn cell_get FromValue<'b> + 'static>( &self, - renderer: &P, + renderer: &impl IsA, property_name: &str, ) -> V { let value = self.cell_get_value(renderer, property_name); @@ -132,9 +124,9 @@ impl> CellAreaExtManual for O { .expect("Failed to get value of renderer") } - fn cell_set>( + fn cell_set( &self, - renderer: &P, + renderer: &impl IsA, property_name: &str, value: &dyn ToValue, ) { @@ -165,11 +157,11 @@ impl> CellAreaExtManual for O { } } - fn event, Q: IsA, R: AsRef>( + fn event( &self, - context: &P, - widget: &Q, - event: &R, + context: &impl IsA, + widget: &impl IsA, + event: &impl AsRef, cell_area: &gdk::Rectangle, flags: CellRendererState, ) -> i32 { diff --git a/gtk4/src/cell_editable.rs b/gtk4/src/cell_editable.rs index 98a134d95ac8..0a29b6abb887 100644 --- a/gtk4/src/cell_editable.rs +++ b/gtk4/src/cell_editable.rs @@ -6,11 +6,11 @@ use glib::IsA; pub trait CellEditableExtManual { #[doc(alias = "gtk_cell_editable_start_editing")] - fn start_editing>(&self, event: Option<&P>); + fn start_editing(&self, event: Option<&impl AsRef>); } impl> CellEditableExtManual for O { - fn start_editing>(&self, event: Option<&P>) { + fn start_editing(&self, event: Option<&impl AsRef>) { unsafe { ffi::gtk_cell_editable_start_editing( self.as_ref().to_glib_none().0, diff --git a/gtk4/src/cell_renderer.rs b/gtk4/src/cell_renderer.rs index 95154126b5f7..13680d1a8fc5 100644 --- a/gtk4/src/cell_renderer.rs +++ b/gtk4/src/cell_renderer.rs @@ -8,10 +8,10 @@ use glib::IsA; /// Trait containing manually implemented methods of [`CellRenderer`](crate::CellRenderer). pub trait CellRendererExtManual { #[doc(alias = "gtk_cell_renderer_activate")] - fn activate, R: AsRef>( + fn activate( &self, - event: &R, - widget: &Q, + event: &impl AsRef, + widget: &impl IsA, path: &str, background_area: &gdk::Rectangle, cell_area: &gdk::Rectangle, @@ -19,10 +19,10 @@ pub trait CellRendererExtManual { ) -> bool; #[doc(alias = "gtk_cell_renderer_start_editing")] - fn start_editing, R: AsRef>( + fn start_editing( &self, - event: Option<&R>, - widget: &Q, + event: Option<&impl AsRef>, + widget: &impl IsA, path: &str, background_area: &gdk::Rectangle, cell_area: &gdk::Rectangle, @@ -31,10 +31,10 @@ pub trait CellRendererExtManual { } impl> CellRendererExtManual for O { - fn activate, R: AsRef>( + fn activate( &self, - event: &R, - widget: &Q, + event: &impl AsRef, + widget: &impl IsA, path: &str, background_area: &gdk::Rectangle, cell_area: &gdk::Rectangle, @@ -53,10 +53,10 @@ impl> CellRendererExtManual for O { } } - fn start_editing, R: AsRef>( + fn start_editing( &self, - event: Option<&R>, - widget: &Q, + event: Option<&impl AsRef>, + widget: &impl IsA, path: &str, background_area: &gdk::Rectangle, cell_area: &gdk::Rectangle, diff --git a/gtk4/src/closure_expression.rs b/gtk4/src/closure_expression.rs index 0036ee565eb8..ac535cac5801 100644 --- a/gtk4/src/closure_expression.rs +++ b/gtk4/src/closure_expression.rs @@ -32,12 +32,11 @@ impl ClosureExpression { } #[doc(alias = "gtk_closure_expression_new")] - pub fn with_callback( - params: impl IntoIterator>, - callback: F, - ) -> Self + pub fn with_callback(params: I, callback: F) -> Self where F: Fn(&[Value]) -> R + 'static, + I: IntoIterator, + E: AsRef, R: ValueType, { assert_initialized_main_thread!(); diff --git a/gtk4/src/directory_list.rs b/gtk4/src/directory_list.rs index 2046c8017950..d0b82cacf391 100644 --- a/gtk4/src/directory_list.rs +++ b/gtk4/src/directory_list.rs @@ -73,7 +73,7 @@ impl DirectoryListBuilder { self } - pub fn file>(mut self, file: &P) -> Self { + pub fn file(mut self, file: &impl IsA) -> Self { self.file = Some(file.clone().upcast()); self } diff --git a/gtk4/src/expression.rs b/gtk4/src/expression.rs index 9c939c1b2dde..534c35e71b10 100644 --- a/gtk4/src/expression.rs +++ b/gtk4/src/expression.rs @@ -52,7 +52,7 @@ impl Expression { } #[doc(alias = "gtk_expression_evaluate")] - pub fn evaluate>(&self, this: Option<&T>) -> Option { + pub fn evaluate(&self, this: Option<&impl IsA>) -> Option { assert_initialized_main_thread!(); unsafe { let mut value = Value::uninitialized(); diff --git a/gtk4/src/file_chooser_dialog.rs b/gtk4/src/file_chooser_dialog.rs index 43097fe43898..35f39f1d3b39 100644 --- a/gtk4/src/file_chooser_dialog.rs +++ b/gtk4/src/file_chooser_dialog.rs @@ -9,9 +9,9 @@ use std::ptr; impl FileChooserDialog { #[doc(alias = "gtk_file_chooser_dialog_new")] - pub fn new>( + pub fn new( title: Option<&str>, - parent: Option<&T>, + parent: Option<&impl IsA>, action: FileChooserAction, buttons: &[(&str, ResponseType)], ) -> Self { diff --git a/gtk4/src/im_context.rs b/gtk4/src/im_context.rs index 46278ca67191..3ca2c4cf279e 100644 --- a/gtk4/src/im_context.rs +++ b/gtk4/src/im_context.rs @@ -9,11 +9,11 @@ use glib::IsA; #[allow(clippy::upper_case_acronyms)] pub trait IMContextExtManual { #[doc(alias = "gtk_im_context_filter_keypress")] - fn filter_keypress>(&self, event: &R) -> bool; + fn filter_keypress(&self, event: &impl AsRef) -> bool; } impl> IMContextExtManual for O { - fn filter_keypress>(&self, event: &R) -> bool { + fn filter_keypress(&self, event: &impl AsRef) -> bool { unsafe { from_glib(ffi::gtk_im_context_filter_keypress( self.as_ref().to_glib_none().0, diff --git a/gtk4/src/im_context_simple.rs b/gtk4/src/im_context_simple.rs index 287e9a43acaf..34673cbf2b04 100644 --- a/gtk4/src/im_context_simple.rs +++ b/gtk4/src/im_context_simple.rs @@ -6,7 +6,7 @@ use std::path::Path; impl IMContextSimple { #[doc(alias = "gtk_im_context_simple_add_compose_file")] - pub fn add_compose_file>(&self, compose_file: P) { + pub fn add_compose_file(&self, compose_file: impl AsRef) { unsafe { let compose_file = compose_file.as_ref(); ffi::gtk_im_context_simple_add_compose_file( diff --git a/gtk4/src/map_list_model.rs b/gtk4/src/map_list_model.rs index 6b47145301bd..14f6a62c2a08 100644 --- a/gtk4/src/map_list_model.rs +++ b/gtk4/src/map_list_model.rs @@ -6,7 +6,7 @@ use glib::IsA; impl MapListModel { #[doc(alias = "gtk_map_list_model_new")] - pub fn without_map_func>(model: Option<&P>) -> Self { + pub fn without_map_func(model: Option<&impl IsA>) -> Self { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_map_list_model_new( diff --git a/gtk4/src/message_dialog.rs b/gtk4/src/message_dialog.rs index 1edcc3157de8..16f5d988c773 100644 --- a/gtk4/src/message_dialog.rs +++ b/gtk4/src/message_dialog.rs @@ -9,8 +9,8 @@ use crate::{ButtonsType, DialogFlags, MessageDialog, MessageType, Widget, Window impl MessageDialog { #[doc(alias = "gtk_message_dialog_new")] - pub fn new>( - parent: Option<&T>, + pub fn new( + parent: Option<&impl IsA>, flags: DialogFlags, type_: MessageType, buttons: ButtonsType, @@ -34,8 +34,8 @@ impl MessageDialog { #[doc(alias = "gtk_message_dialog_new_with_markup")] #[doc(alias = "new_with_markup")] - pub fn with_markup>( - parent: Option<&P>, + pub fn with_markup( + parent: Option<&impl IsA>, flags: DialogFlags, type_: MessageType, buttons: ButtonsType, diff --git a/gtk4/src/notebook.rs b/gtk4/src/notebook.rs index 30a84d0aad91..8ace1447e214 100644 --- a/gtk4/src/notebook.rs +++ b/gtk4/src/notebook.rs @@ -7,10 +7,10 @@ use libc::c_int; impl Notebook { #[doc(alias = "gtk_notebook_append_page")] - pub fn append_page, U: IsA>( + pub fn append_page( &self, - child: &T, - tab_label: Option<&U>, + child: &impl IsA, + tab_label: Option<&impl IsA>, ) -> u32 { unsafe { let ret = ffi::gtk_notebook_append_page( @@ -24,17 +24,12 @@ impl Notebook { } #[doc(alias = "gtk_notebook_append_page_menu")] - pub fn append_page_menu( + pub fn append_page_menu( &self, - child: &T, - tab_label: Option<&U>, - menu_label: Option<&V>, - ) -> u32 - where - T: IsA, - U: IsA, - V: IsA, - { + child: &impl IsA, + tab_label: Option<&impl IsA>, + menu_label: Option<&impl IsA>, + ) -> u32 { unsafe { let ret = ffi::gtk_notebook_append_page_menu( self.to_glib_none().0, @@ -82,11 +77,12 @@ impl Notebook { } #[doc(alias = "gtk_notebook_insert_page")] - pub fn insert_page(&self, child: &T, tab_label: Option<&U>, position: Option) -> u32 - where - T: IsA, - U: IsA, - { + pub fn insert_page( + &self, + child: &impl IsA, + tab_label: Option<&impl IsA>, + position: Option, + ) -> u32 { unsafe { let ret = ffi::gtk_notebook_insert_page( self.to_glib_none().0, @@ -100,18 +96,13 @@ impl Notebook { } #[doc(alias = "gtk_notebook_insert_page_menu")] - pub fn insert_page_menu( + pub fn insert_page_menu( &self, - child: &T, - tab_label: Option<&U>, - menu_label: Option<&V>, + child: &impl IsA, + tab_label: Option<&impl IsA>, + menu_label: Option<&impl IsA>, position: Option, - ) -> u32 - where - T: IsA, - U: IsA, - V: IsA, - { + ) -> u32 { unsafe { let ret = ffi::gtk_notebook_insert_page_menu( self.to_glib_none().0, @@ -125,7 +116,7 @@ impl Notebook { } } #[doc(alias = "gtk_notebook_page_num")] - pub fn page_num>(&self, child: &T) -> Option { + pub fn page_num(&self, child: &impl IsA) -> Option { unsafe { let ret = ffi::gtk_notebook_page_num(self.to_glib_none().0, child.as_ref().to_glib_none().0); @@ -137,11 +128,11 @@ impl Notebook { } } #[doc(alias = "gtk_notebook_prepend_page")] - pub fn prepend_page(&self, child: &T, tab_label: Option<&U>) -> u32 - where - T: IsA, - U: IsA, - { + pub fn prepend_page( + &self, + child: &impl IsA, + tab_label: Option<&impl IsA>, + ) -> u32 { unsafe { let ret = ffi::gtk_notebook_prepend_page( self.to_glib_none().0, @@ -154,17 +145,12 @@ impl Notebook { } #[doc(alias = "gtk_notebook_prepend_page_menu")] - pub fn prepend_page_menu( + pub fn prepend_page_menu( &self, - child: &T, - tab_label: Option<&U>, - menu_label: Option<&V>, - ) -> u32 - where - T: IsA, - U: IsA, - V: IsA, - { + child: &impl IsA, + tab_label: Option<&impl IsA>, + menu_label: Option<&impl IsA>, + ) -> u32 { unsafe { let ret = ffi::gtk_notebook_prepend_page_menu( self.to_glib_none().0, @@ -188,7 +174,7 @@ impl Notebook { } #[doc(alias = "gtk_notebook_reorder_child")] - pub fn reorder_child>(&self, child: &T, position: Option) { + pub fn reorder_child(&self, child: &impl IsA, position: Option) { unsafe { ffi::gtk_notebook_reorder_child( self.to_glib_none().0, diff --git a/gtk4/src/shortcut_trigger.rs b/gtk4/src/shortcut_trigger.rs index 1c124ed1042a..d1426fea4fc4 100644 --- a/gtk4/src/shortcut_trigger.rs +++ b/gtk4/src/shortcut_trigger.rs @@ -8,10 +8,10 @@ use glib::IsA; /// Trait containing manually implemented methods of [`ShortcutTrigger`](crate::ShortcutTrigger). pub trait ShortcutTriggerExtManual { #[doc(alias = "gtk_shortcut_trigger_compare")] - fn compare>(&self, trigger2: &P) -> std::cmp::Ordering; + fn compare(&self, trigger2: &impl IsA) -> std::cmp::Ordering; #[doc(alias = "gtk_shortcut_trigger_equal")] - fn equal>(&self, trigger2: &P) -> bool; + fn equal(&self, trigger2: &impl IsA) -> bool; #[doc(alias = "gtk_shortcut_trigger_hash")] fn hash(&self) -> u32; @@ -21,7 +21,7 @@ pub trait ShortcutTriggerExtManual { } impl> ShortcutTriggerExtManual for O { - fn compare>(&self, trigger2: &P) -> std::cmp::Ordering { + fn compare(&self, trigger2: &impl IsA) -> std::cmp::Ordering { unsafe { from_glib(ffi::gtk_shortcut_trigger_compare( ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(self.as_ref()).0 @@ -32,7 +32,7 @@ impl> ShortcutTriggerExtManual for O { } } - fn equal>(&self, trigger2: &P) -> bool { + fn equal(&self, trigger2: &impl IsA) -> bool { unsafe { from_glib(ffi::gtk_shortcut_trigger_equal( ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(self.as_ref()).0 diff --git a/gtk4/src/text_view.rs b/gtk4/src/text_view.rs index bcc547d89733..5d7b6fe6064e 100644 --- a/gtk4/src/text_view.rs +++ b/gtk4/src/text_view.rs @@ -8,11 +8,11 @@ use glib::IsA; /// Trait containing manually implemented methods of [`TextView`](crate::TextView). pub trait TextViewExtManual { #[doc(alias = "gtk_text_view_im_context_filter_keypress")] - fn im_context_filter_keypress>(&self, event: &R) -> bool; + fn im_context_filter_keypress(&self, event: &impl AsRef) -> bool; } impl> TextViewExtManual for O { - fn im_context_filter_keypress>(&self, event: &R) -> bool { + fn im_context_filter_keypress(&self, event: &impl AsRef) -> bool { unsafe { from_glib(ffi::gtk_text_view_im_context_filter_keypress( self.as_ref().to_glib_none().0, diff --git a/gtk4/src/tree_model_filter.rs b/gtk4/src/tree_model_filter.rs index 9666da0c2cb2..ff3582e37869 100644 --- a/gtk4/src/tree_model_filter.rs +++ b/gtk4/src/tree_model_filter.rs @@ -8,7 +8,7 @@ use crate::{TreeIter, TreeModel, TreeModelFilter, TreePath}; impl TreeModelFilter { #[doc(alias = "gtk_tree_model_filter_new")] - pub fn new>(child_model: &T, root: Option<&TreePath>) -> Self { + pub fn new(child_model: &impl IsA, root: Option<&TreePath>) -> Self { skip_assert_initialized!(); unsafe { TreeModel::from_glib_none(ffi::gtk_tree_model_filter_new( diff --git a/gtk4/src/tree_row_reference.rs b/gtk4/src/tree_row_reference.rs index 1c71e208b41b..6db20aac05dc 100644 --- a/gtk4/src/tree_row_reference.rs +++ b/gtk4/src/tree_row_reference.rs @@ -7,9 +7,9 @@ use glib::IsA; impl TreeRowReference { #[doc(alias = "gtk_tree_row_reference_reordered")] - pub fn reordered>( + pub fn reordered( &self, - proxy: &P, + proxy: &impl IsA, path: &TreePath, iter: &TreeIter, new_order: &[i32], diff --git a/gtk4/src/tree_view_column.rs b/gtk4/src/tree_view_column.rs index 4bec73f61b0c..c0d1df4500c1 100644 --- a/gtk4/src/tree_view_column.rs +++ b/gtk4/src/tree_view_column.rs @@ -91,7 +91,7 @@ impl TreeViewColumn { #[doc(alias = "gtk_tree_view_column_set_cell_data_func")] #[doc(alias = "set_cell_data_func")] - pub fn unset_cell_data_func>(&self, cell_renderer: &P) { + pub fn unset_cell_data_func(&self, cell_renderer: &impl IsA) { unsafe { ffi::gtk_tree_view_column_set_cell_data_func( self.to_glib_none().0,