From 2be6651e3dd7a799b83e078baefe66a12ae10400 Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Mon, 3 Feb 2025 15:55:27 +0000 Subject: [PATCH 1/2] Add span to callables generation to improve error messages --- .../cxx-qt-gen/src/generator/rust/inherit.rs | 10 ++-- .../cxx-qt-gen/src/generator/rust/signals.rs | 47 ++++++++++++------- crates/cxx-qt-gen/src/naming/type_names.rs | 5 +- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/crates/cxx-qt-gen/src/generator/rust/inherit.rs b/crates/cxx-qt-gen/src/generator/rust/inherit.rs index 2ea07fc24..12107af55 100644 --- a/crates/cxx-qt-gen/src/generator/rust/inherit.rs +++ b/crates/cxx-qt-gen/src/generator/rust/inherit.rs @@ -31,17 +31,19 @@ pub fn generate( }) .collect::>(); + let span = method.method.span(); + let ident = &method.method_fields.name.rust_unqualified(); let cxx_name_string = &method.wrapper_ident().to_string(); let self_param = if method.mutable { - quote! { self: Pin<&mut #qobject_name> } + quote_spanned! { span => self: Pin<&mut #qobject_name> } } else { - quote! { self: &#qobject_name } + quote_spanned! { span => self: &#qobject_name } }; let return_type = &method.method.sig.output; let mut unsafe_block = None; - let mut unsafe_call = Some(quote! { unsafe }); + let mut unsafe_call = Some(quote_spanned! { span => unsafe }); if method.safe { std::mem::swap(&mut unsafe_call, &mut unsafe_block); } @@ -50,7 +52,7 @@ pub fn generate( let namespace = qobject_names.namespace_tokens(); syn::parse2(quote_spanned! { - method.method.span() => + span => #unsafe_block extern "C++" { #[cxx_name = #cxx_name_string] #namespace diff --git a/crates/cxx-qt-gen/src/generator/rust/signals.rs b/crates/cxx-qt-gen/src/generator/rust/signals.rs index dfe22deed..b46a19d6a 100644 --- a/crates/cxx-qt-gen/src/generator/rust/signals.rs +++ b/crates/cxx-qt-gen/src/generator/rust/signals.rs @@ -15,14 +15,16 @@ use crate::{ naming::{rust::syn_type_cxx_bridge_to_qualified, Name, TypeNames}, parser::signals::ParsedSignal, }; -use quote::quote; -use syn::{parse_quote, FnArg, Ident, Result, Type}; +use quote::{quote, quote_spanned}; +use syn::spanned::Spanned; +use syn::{parse_quote, parse_quote_spanned, FnArg, Ident, Result, Type}; pub fn generate_rust_signal( signal: &ParsedSignal, qobject_name: &Name, type_names: &TypeNames, ) -> Result { + let span = signal.method.span(); let idents = QSignalNames::from(signal); let idents_helper = QSignalHelperNames::new(&idents, qobject_name)?; @@ -79,7 +81,7 @@ pub fn generate_rust_signal( .collect::>()?; let self_type_cxx = if signal.mutable { - parse_quote! { Pin<&mut #qobject_name_rust> } + parse_quote_spanned! {span => Pin<&mut #qobject_name_rust> } } else { // CODECOV_EXCLUDE_START unreachable!("Signals cannot be immutable right now so this cannot be reached") @@ -101,7 +103,7 @@ pub fn generate_rust_signal( let doc_comments = &signal.docs; let cfgs = &signal.cfgs; let namespace = if let Some(namespace) = qobject_name.namespace() { - quote! { #[namespace = #namespace ] } + quote_spanned! { span=> #[namespace = #namespace ] } } else { quote! {} }; @@ -123,7 +125,8 @@ pub fn generate_rust_signal( // TODO: what happens with RustQt signals, can they be private yet? if !signal.private { - cxx_mod_contents.push(parse_quote! { + cxx_mod_contents.push(parse_quote_spanned! { + span=> #unsafe_block extern "C++" { #[cxx_name = #cpp_ident] #(#cfgs)* @@ -135,7 +138,8 @@ pub fn generate_rust_signal( } cxx_mod_contents.extend(vec![ - parse_quote! { + parse_quote_spanned! { + span=> #(#cfgs)* unsafe extern "C++" { #[doc(hidden)] @@ -148,8 +152,8 @@ pub fn generate_rust_signal( fn #free_connect_ident_rust(self_value: #self_type_cxx, signal_handler: #signal_handler_alias, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } }, - parse_quote! { - #(#cfgs)* + parse_quote_spanned! { + span=> #[namespace = #namespace_str] extern "Rust" { #[doc(hidden)] @@ -158,13 +162,13 @@ pub fn generate_rust_signal( #[doc(hidden)] #unsafe_call fn #signal_handler_call(handler: &mut #signal_handler_alias, self_value: #self_type_cxx, #(#parameters_cxx),*); } - }, - ]); + }]); Ok(GeneratedRustFragment { cxx_mod_contents, cxx_qt_mod_contents: vec![ - parse_quote! { + parse_quote_spanned! { + span=> #(#cfgs)* impl #qualified_impl { #[doc = "Connect the given function pointer to the signal "] @@ -180,7 +184,8 @@ pub fn generate_rust_signal( } } }, - parse_quote! { + parse_quote_spanned! { + span=> #(#cfgs)* impl #qualified_impl { #[doc = "Connect the given function pointer to the signal "] @@ -198,23 +203,27 @@ pub fn generate_rust_signal( } } }, - parse_quote! { + parse_quote_spanned! { + span => #(#cfgs)* #[doc(hidden)] pub struct #closure_struct {} }, - parse_quote! { + parse_quote_spanned! { + span => #(#cfgs)* impl cxx_qt::signalhandler::CxxQtSignalHandlerClosure for #closure_struct { type Id = cxx::type_id!(#signal_handler_alias_namespaced_str); type FnType = dyn FnMut(#self_type_qualified, #(#parameters_qualified_type),*) + Send; } }, - parse_quote! { + parse_quote_spanned! { + span => #(#cfgs)* use core::mem::drop as #signal_handler_drop; }, - parse_quote! { + parse_quote_spanned! { + span => #(#cfgs)* fn #signal_handler_call( handler: &mut cxx_qt::signalhandler::CxxQtSignalHandler<#closure_struct>, @@ -224,11 +233,13 @@ pub fn generate_rust_signal( handler.closure()(self_value, #(#parameters_name),*); } }, - parse_quote! { + parse_quote_spanned! { + span => #(#cfgs)* cxx_qt::static_assertions::assert_eq_align!(cxx_qt::signalhandler::CxxQtSignalHandler<#closure_struct>, usize); }, - parse_quote! { + parse_quote_spanned! { + span => #(#cfgs)* cxx_qt::static_assertions::assert_eq_size!(cxx_qt::signalhandler::CxxQtSignalHandler<#closure_struct>, [usize; 2]); }, diff --git a/crates/cxx-qt-gen/src/naming/type_names.rs b/crates/cxx-qt-gen/src/naming/type_names.rs index b2730ec6f..ac0c321fc 100644 --- a/crates/cxx-qt-gen/src/naming/type_names.rs +++ b/crates/cxx-qt-gen/src/naming/type_names.rs @@ -183,10 +183,7 @@ impl TypeNames { self.insert(qobject.name.clone())?; } - // Find and register the names of any signals in extern "C++Qt" - for signal in extern_cxxqt.signals.iter() { - self.insert(signal.name.clone())?; - } + // TODO! Do we still need to find and register the names of any signals in extern "C++Qt" } Ok(()) From c0196e366d71a6b80c3bd2349bb3b3e679f75034 Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Mon, 3 Feb 2025 17:22:42 +0000 Subject: [PATCH 2/2] Fix clippy lints --- .../cxx-qt-gen/src/generator/rust/inherit.rs | 3 +- .../src/generator/rust/property/mod.rs | 12 +++--- .../cxx-qt-gen/src/generator/rust/signals.rs | 20 +++++----- crates/cxx-qt-gen/test_outputs/cfgs.rs | 40 ++++++++----------- .../test_outputs/passthrough_and_naming.rs | 28 ++++++------- crates/cxx-qt-gen/test_outputs/properties.rs | 28 ++++++------- crates/cxx-qt-gen/test_outputs/signals.rs | 16 ++++---- .../rust/src/custom_base_class.rs | 30 +++++++++++--- 8 files changed, 94 insertions(+), 83 deletions(-) diff --git a/crates/cxx-qt-gen/src/generator/rust/inherit.rs b/crates/cxx-qt-gen/src/generator/rust/inherit.rs index 12107af55..b91f30fac 100644 --- a/crates/cxx-qt-gen/src/generator/rust/inherit.rs +++ b/crates/cxx-qt-gen/src/generator/rust/inherit.rs @@ -43,7 +43,8 @@ pub fn generate( let return_type = &method.method.sig.output; let mut unsafe_block = None; - let mut unsafe_call = Some(quote_spanned! { span => unsafe }); + // Needs to be unspanned or clippy breaks surrounding the safety comment + let mut unsafe_call = Some(quote! { unsafe }); if method.safe { std::mem::swap(&mut unsafe_call, &mut unsafe_block); } diff --git a/crates/cxx-qt-gen/src/generator/rust/property/mod.rs b/crates/cxx-qt-gen/src/generator/rust/property/mod.rs index 7461c5024..db3e46e6a 100644 --- a/crates/cxx-qt-gen/src/generator/rust/property/mod.rs +++ b/crates/cxx-qt-gen/src/generator/rust/property/mod.rs @@ -310,7 +310,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "trivialPropertyChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_trivial_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_trivial_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_trivial_property_changed( self, @@ -330,7 +330,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_trivial_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_trivial_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_trivial_property_changed( self, @@ -435,7 +435,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "opaquePropertyChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_opaque_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_opaque_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_opaque_property_changed( self, @@ -455,7 +455,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_opaque_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_opaque_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_opaque_property_changed( self, @@ -560,7 +560,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "unsafePropertyChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_unsafe_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_unsafe_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_unsafe_property_changed( self, @@ -580,7 +580,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_unsafe_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_unsafe_property_changed, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_unsafe_property_changed( self, diff --git a/crates/cxx-qt-gen/src/generator/rust/signals.rs b/crates/cxx-qt-gen/src/generator/rust/signals.rs index b46a19d6a..f2b86499d 100644 --- a/crates/cxx-qt-gen/src/generator/rust/signals.rs +++ b/crates/cxx-qt-gen/src/generator/rust/signals.rs @@ -174,7 +174,7 @@ pub fn generate_rust_signal( #[doc = "Connect the given function pointer to the signal "] #[doc = #signal_name_cpp] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn #connect_ident_rust(self: #self_type_qualified, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn #connect_ident_rust(self: #self_type_qualified, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(#module_ident::#free_connect_ident_rust( self, @@ -193,7 +193,7 @@ pub fn generate_rust_signal( #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn #on_ident_rust(self: #self_type_qualified, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn #on_ident_rust(self: #self_type_qualified, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(#module_ident::#free_connect_ident_rust( self, @@ -310,7 +310,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_ready, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_ready, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_ready( self, @@ -330,7 +330,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_ready, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_ready, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_ready( self, @@ -484,7 +484,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "dataChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_data_changed, i32, cxx::UniquePtr) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_data_changed, i32, cxx::UniquePtr) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_data_changed( self, @@ -504,7 +504,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_data_changed, i32, cxx::UniquePtr) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_data_changed, i32, cxx::UniquePtr) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_data_changed( self, @@ -626,7 +626,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "unsafeSignal"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_unsafe_signal, *mut T) + 'static +Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_unsafe_signal, *mut T) + 'static +Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_unsafe_signal( self, @@ -646,7 +646,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_unsafe_signal, *mut T) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_unsafe_signal, *mut T) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_unsafe_signal( self, @@ -769,7 +769,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "baseName"] #[doc = ", so that when the signal is emitted the function pointer is executed."] - pub fn connect_existing_signal, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard + pub fn connect_existing_signal, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_existing_signal( self, @@ -789,7 +789,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] - pub fn on_existing_signal, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard + pub fn on_existing_signal, ) + 'static + Send>(self: core::pin::Pin<&mut qobject::MyObject>, closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(qobject::MyObject_connect_existing_signal( self, diff --git a/crates/cxx-qt-gen/test_outputs/cfgs.rs b/crates/cxx-qt-gen/test_outputs/cfgs.rs index b07954b71..ef8ec7e7e 100644 --- a/crates/cxx-qt-gen/test_outputs/cfgs.rs +++ b/crates/cxx-qt-gen/test_outputs/cfgs.rs @@ -112,7 +112,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(not(enabled))] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -147,7 +146,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(enabled)] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -240,7 +238,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(not(enabled))] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -275,7 +272,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(enabled)] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -336,7 +332,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(not(enabled))] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -371,7 +366,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(enabled)] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -410,7 +404,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(not(enabled))] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -445,7 +438,6 @@ mod ffi { conn_type: CxxQtConnectionType, ) -> CxxQtQMetaObjectConnection; } - #[cfg(enabled)] #[namespace = "rust::cxxqtgen1"] extern "Rust" { #[doc(hidden)] @@ -468,7 +460,7 @@ impl ffi::QObjectEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectEnabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectEnabled_connect_signal_disabled( @@ -491,7 +483,7 @@ impl ffi::QObjectEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectEnabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectEnabled_connect_signal_disabled( self, @@ -542,7 +534,7 @@ impl ffi::QObjectEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectEnabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectEnabled_connect_signal_enabled( @@ -565,7 +557,7 @@ impl ffi::QObjectEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectEnabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectEnabled_connect_signal_enabled( self, @@ -639,7 +631,7 @@ impl ffi::QObjectDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectDisabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectDisabled_connect_signal_disabled( @@ -662,7 +654,7 @@ impl ffi::QObjectDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectDisabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectDisabled_connect_signal_disabled( self, @@ -713,7 +705,7 @@ impl ffi::QObjectDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectDisabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectDisabled_connect_signal_enabled( @@ -736,7 +728,7 @@ impl ffi::QObjectDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectDisabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectDisabled_connect_signal_enabled( self, @@ -810,7 +802,7 @@ impl ffi::QObjectExternEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternEnabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( @@ -835,7 +827,7 @@ impl ffi::QObjectExternEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternEnabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( ffi::QObjectExternEnabled_connect_signal_disabled1( @@ -893,7 +885,7 @@ impl ffi::QObjectExternEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternEnabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectExternEnabled_connect_signal_enabled1( @@ -916,7 +908,7 @@ impl ffi::QObjectExternEnabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternEnabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternEnabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QObjectExternEnabled_connect_signal_enabled1( self, @@ -972,7 +964,7 @@ impl ffi::QObjectExternDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternDisabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( @@ -997,7 +989,7 @@ impl ffi::QObjectExternDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternDisabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( ffi::QObjectExternDisabled_connect_signal_disabled2( @@ -1055,7 +1047,7 @@ impl ffi::QObjectExternDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternDisabled>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( @@ -1080,7 +1072,7 @@ impl ffi::QObjectExternDisabled { F: FnMut(core::pin::Pin<&mut ffi::QObjectExternDisabled>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QObjectExternDisabled>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( ffi::QObjectExternDisabled_connect_signal_enabled2( diff --git a/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs b/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs index ac3b9af56..c2d4d6493 100644 --- a/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs +++ b/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs @@ -471,7 +471,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_property_name_changed( @@ -493,7 +493,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_property_name_changed( self, @@ -537,7 +537,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] pub fn connect_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -557,7 +557,7 @@ impl ffi::MyObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( self, @@ -637,7 +637,7 @@ impl ffi::SecondObject { F: FnMut(core::pin::Pin<&mut ffi::SecondObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::SecondObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::SecondObject_connect_property_name_changed( @@ -659,7 +659,7 @@ impl ffi::SecondObject { F: FnMut(core::pin::Pin<&mut ffi::SecondObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::SecondObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::SecondObject_connect_property_name_changed( self, @@ -703,7 +703,7 @@ impl ffi::SecondObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] pub fn connect_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::SecondObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::SecondObject_connect_ready( @@ -723,7 +723,7 @@ impl ffi::SecondObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::SecondObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::SecondObject_connect_ready( self, @@ -804,7 +804,7 @@ impl ffi::QPushButton { F: FnMut(core::pin::Pin<&mut ffi::QPushButton>, bool) + 'static + Send, >( self: core::pin::Pin<&mut ffi::QPushButton>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QPushButton_connect_clicked( @@ -824,7 +824,7 @@ impl ffi::QPushButton { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_clicked, bool) + 'static + Send>( self: core::pin::Pin<&mut ffi::QPushButton>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QPushButton_connect_clicked( self, @@ -865,7 +865,7 @@ impl ffi::ExternObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] pub fn connect_data_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::ExternObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: ExternObject_connect_data_ready (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < ExternObjectCxxQtSignalClosuredataReady > :: new (Box :: new (closure)) , conn_type ,)) @@ -879,7 +879,7 @@ impl ffi::ExternObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_data_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::ExternObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: ExternObject_connect_data_ready (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < ExternObjectCxxQtSignalClosuredataReady > :: new (Box :: new (closure)) , cxx_qt :: ConnectionType :: AutoConnection ,)) } @@ -916,7 +916,7 @@ impl ffi::ExternObject { F: FnMut(core::pin::Pin<&mut ffi::ExternObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::ExternObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( @@ -938,7 +938,7 @@ impl ffi::ExternObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_error_occurred) + 'static + Send>( self: core::pin::Pin<&mut ffi::ExternObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( ffi::ExternObject_connect_error_occurred( diff --git a/crates/cxx-qt-gen/test_outputs/properties.rs b/crates/cxx-qt-gen/test_outputs/properties.rs index 6104617d2..498f3a677 100644 --- a/crates/cxx-qt-gen/test_outputs/properties.rs +++ b/crates/cxx-qt-gen/test_outputs/properties.rs @@ -597,7 +597,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( @@ -619,7 +619,7 @@ impl ffi::MyObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_primitive_changed) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( ffi::MyObject_connect_primitive_changed( @@ -667,7 +667,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: MyObject_connect_trivial_changed (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < MyObjectCxxQtSignalClosuretrivialChanged > :: new (Box :: new (closure)) , conn_type ,)) @@ -681,7 +681,7 @@ impl ffi::MyObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_trivial_changed) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: MyObject_connect_trivial_changed (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < MyObjectCxxQtSignalClosuretrivialChanged > :: new (Box :: new (closure)) , cxx_qt :: ConnectionType :: AutoConnection ,)) } @@ -719,7 +719,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_prop_auto_cxx_name_changed( @@ -741,7 +741,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_prop_auto_cxx_name_changed( self, @@ -787,7 +787,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( @@ -811,7 +811,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from( ffi::MyObject_connect_custom_function_prop_changed( @@ -859,7 +859,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_renamed_property_changed( @@ -881,7 +881,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_renamed_property_changed( self, @@ -927,7 +927,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_renamed_property_2_changed( @@ -949,7 +949,7 @@ impl ffi::MyObject { F: FnMut(core::pin::Pin<&mut ffi::MyObject>) + 'static + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_renamed_property_2_changed( self, @@ -993,7 +993,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] pub fn connect_my_on_changed) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: MyObject_connect_my_on_changed (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < MyObjectCxxQtSignalClosuremy_on_changed > :: new (Box :: new (closure)) , conn_type ,)) @@ -1007,7 +1007,7 @@ impl ffi::MyObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_my_on_changed) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: MyObject_connect_my_on_changed (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < MyObjectCxxQtSignalClosuremy_on_changed > :: new (Box :: new (closure)) , cxx_qt :: ConnectionType :: AutoConnection ,)) } diff --git a/crates/cxx-qt-gen/test_outputs/signals.rs b/crates/cxx-qt-gen/test_outputs/signals.rs index c0091df81..664cb8db3 100644 --- a/crates/cxx-qt-gen/test_outputs/signals.rs +++ b/crates/cxx-qt-gen/test_outputs/signals.rs @@ -208,7 +208,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] pub fn connect_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -228,7 +228,7 @@ impl ffi::MyObject { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_ready) + 'static + Send>( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( self, @@ -277,7 +277,7 @@ impl ffi::MyObject { + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: MyObject_connect_data_changed (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < MyObjectCxxQtSignalClosuredata_changed > :: new (Box :: new (closure)) , conn_type ,)) @@ -301,7 +301,7 @@ impl ffi::MyObject { + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt :: QMetaObjectConnectionGuard :: from (ffi :: MyObject_connect_data_changed (self , cxx_qt :: signalhandler :: CxxQtSignalHandler :: < MyObjectCxxQtSignalClosuredata_changed > :: new (Box :: new (closure)) , cxx_qt :: ConnectionType :: AutoConnection ,)) } @@ -355,7 +355,7 @@ impl ffi::MyObject { + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_base_class_new_data( @@ -385,7 +385,7 @@ impl ffi::MyObject { + Send, >( self: core::pin::Pin<&mut ffi::MyObject>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_base_class_new_data( self, @@ -454,7 +454,7 @@ impl ffi::QTimer { #[doc = ", so that when the signal is emitted the function pointer is executed."] pub fn connect_timeout) + 'static + Send>( self: core::pin::Pin<&mut ffi::QTimer>, - mut closure: F, + closure: F, conn_type: cxx_qt::ConnectionType, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QTimer_connect_timeout( @@ -474,7 +474,7 @@ impl ffi::QTimer { #[doc = "Note that this method uses a AutoConnection connection type."] pub fn on_timeout) + 'static + Send>( self: core::pin::Pin<&mut ffi::QTimer>, - mut closure: F, + closure: F, ) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::QTimer_connect_timeout( self, diff --git a/examples/qml_features/rust/src/custom_base_class.rs b/examples/qml_features/rust/src/custom_base_class.rs index 0ac7a56ef..6801dff35 100644 --- a/examples/qml_features/rust/src/custom_base_class.rs +++ b/examples/qml_features/rust/src/custom_base_class.rs @@ -125,7 +125,10 @@ pub mod qobject { // ANCHOR: book_inherit_qalm_impl_unsafe // Create Rust bindings for C++ functions of the base class (QAbstractItemModel) extern "RustQt" { - /// Inherited beginInsertRows from the base class + /// # Safety + /// + /// Inherited beginInsertRows from the base class. + /// If you call begin_insert_rows, it is your responsibility to ensure end_insert_rows is called #[inherit] #[cxx_name = "beginInsertRows"] unsafe fn begin_insert_rows( @@ -134,12 +137,18 @@ pub mod qobject { first: i32, last: i32, ); - /// Inherited endInsertRows from the base class + /// # Safety + /// + /// Inherited endInsertRows from the base class. + /// If you call `begin_insert_rows`, it is your responsibility to ensure `end_insert_rows` is called #[inherit] #[cxx_name = "endInsertRows"] unsafe fn end_insert_rows(self: Pin<&mut CustomBaseClass>); - /// Inherited beginRemoveRows from the base class + /// # Safety + /// + /// Inherited beginRemoveRows from the base class. + /// If you call `begin_remove_rows`, it is your responsibility to ensure `end_remove_rows` is called #[inherit] #[cxx_name = "beginRemoveRows"] unsafe fn begin_remove_rows( @@ -148,16 +157,25 @@ pub mod qobject { first: i32, last: i32, ); - /// Inherited endRemoveRows from the base class + /// # Safety + /// + /// Inherited endRemoveRows from the base class. + /// If you call `begin_remove_rows`, it is your responsibility to ensure `end_remove_rows` is called #[inherit] #[cxx_name = "endRemoveRows"] unsafe fn end_remove_rows(self: Pin<&mut CustomBaseClass>); - /// Inherited beginResetModel from the base class + /// # Safety + /// + /// Inherited beginResetModel from the base class. + /// If you call `begin_reset_model`, it is your responsibility to ensure `end_reset_model` is called #[inherit] #[cxx_name = "beginResetModel"] unsafe fn begin_reset_model(self: Pin<&mut CustomBaseClass>); - /// Inherited endResetModel from the base class + /// # Safety + /// + /// Inherited endResetModel from the base class. + /// If you call `begin_reset_model`, it is your responsibility to ensure `end_reset_model` is called #[inherit] #[cxx_name = "endResetModel"] unsafe fn end_reset_model(self: Pin<&mut CustomBaseClass>);