Skip to content

Commit aa9ac43

Browse files
authored
Merge pull request #1152 from Houtamelo/signal_api_improvements
Signal API improvements
2 parents 5a4846e + 74a11b0 commit aa9ac43

File tree

11 files changed

+489
-505
lines changed

11 files changed

+489
-505
lines changed

godot-codegen/src/generator/signals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ fn make_with_signals_impl(
120120

121121
// During construction, C = Self.
122122
#[doc(hidden)]
123-
fn __signals_from_external(gd_mut: &mut Gd<Self>) -> Self::SignalCollection<'_, Self> {
123+
fn __signals_from_external(gd_ref: & Gd<Self>) -> Self::SignalCollection<'_, Self> {
124124
Self::SignalCollection {
125-
__internal_obj: Some(gd_mut.clone()),
125+
__internal_obj: Some(gd_ref.clone()),
126126
}
127127
}
128128
}

godot-core/src/obj/gd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ where
732732
///
733733
/// [`WithUserSignals::signals()`]: crate::obj::WithUserSignals::signals()
734734
#[cfg(since_api = "4.2")]
735-
pub fn signals(&mut self) -> T::SignalCollection<'_, T> {
735+
pub fn signals(&self) -> T::SignalCollection<'_, T> {
736736
T::__signals_from_external(self)
737737
}
738738
}

godot-core/src/obj/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ pub trait WithSignals: GodotClass + Inherits<crate::classes::Object> {
473473
///
474474
/// Takes by reference and not value, to retain lifetime chain.
475475
#[doc(hidden)]
476-
fn __signals_from_external(external: &mut Gd<Self>) -> Self::SignalCollection<'_, Self>;
476+
fn __signals_from_external(external: &Gd<Self>) -> Self::SignalCollection<'_, Self>;
477477
}
478478

479479
/// Implemented for user-defined classes with at least one `#[signal]` declaration.

0 commit comments

Comments
 (0)