Skip to content

Commit cedb206

Browse files
committed
Formatting
1 parent 546dbd6 commit cedb206

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

godot-core/src/registry/signal/typed_signal.rs

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
66
*/
77

8+
use std::borrow::Cow;
9+
use std::marker::PhantomData;
10+
use std::ops::DerefMut;
11+
812
use super::{make_callable_name, make_godot_fn, ConnectBuilder, ConnectHandle, SignalObject};
913
use crate::builtin::{Callable, Variant};
1014
use crate::classes::object::ConnectFlags;
1115
use crate::meta;
1216
use crate::meta::{InParamTuple, ObjectToOwned, UniformObjectDeref};
1317
use crate::obj::{Gd, GodotClass, WithSignals};
1418
use crate::registry::signal::signal_receiver::{IndirectSignalReceiver, SignalReceiver};
15-
use std::borrow::Cow;
16-
use std::marker::PhantomData;
17-
use std::ops::DerefMut;
18-
// ----------------------------------------------------------------------------------------------------------------------------------------------
1919

2020
/// Type-safe version of a Godot signal.
2121
///
@@ -205,38 +205,36 @@ impl<C: WithSignals, Ps: InParamTuple + 'static> TypedSignal<'_, C, Ps> {
205205
/// # #[derive(GodotClass)]
206206
/// # #[class(init, base=Node)]
207207
/// # pub struct Player {
208-
/// # health_ui: OnEditor<Gd<HealthUI>>,
208+
/// # ui: OnEditor<Gd<HealthUi>>,
209209
/// # base: Base<Node>,
210210
/// # }
211211
/// # #[derive(GodotClass)]
212212
/// # #[class(init, base=Node2D)]
213-
/// # pub struct HealthUI {
213+
/// # pub struct HealthUi {
214214
/// # base: Base<Node2D>,
215215
/// # }
216-
/// # #[godot_api]
217-
/// # impl Player {
218-
/// # #[signal]
219-
/// # fn health_changed(health: i32);
220-
/// # }
221-
/// impl Player {
222-
/// fn change_health_anim(&mut self, health: i32) {
223-
/// // Change animation based on health
224-
/// }
225-
/// }
226-
/// impl HealthUI {
227-
/// fn on_health_changed(&mut self, health: i32) {
228-
/// // Change healthbar UI based on health
229-
/// }
230-
/// }
216+
/// #[godot_api]
217+
/// impl Player {
218+
/// #[signal]
219+
/// fn health_changed(health: i32);
220+
///
221+
/// fn change_health_anim(&mut self, health: i32) { /* ... */ }
222+
/// }
223+
/// impl HealthUi {
224+
/// fn on_health_changed(&mut self, health: i32) { /* ... */ }
225+
/// }
231226
/// #[godot_api]
232227
/// impl INode for Player {
233228
/// fn ready(&mut self) {
234-
/// self.signals() // Connect to self
229+
/// // Connect to this object.
230+
/// self.signals()
235231
/// .health_changed()
236232
/// .connect_self(Self::change_health_anim);
237-
/// self.signals() // Connect to other object (health_ui is OnEditor<Gd<HealthUI>>)
233+
///
234+
/// // Connect to other object, where ui: OnEditor<Gd<HealthUi>>.
235+
/// self.signals()
238236
/// .health_changed()
239-
/// .connect_self(|s, amount| s.health_ui.bind_mut().on_health_changed(amount));
237+
/// .connect_self(|this, amount| this.ui.bind_mut().on_health_changed(amount));
240238
/// }
241239
/// }
242240
/// ```
@@ -295,11 +293,14 @@ impl<C: WithSignals, Ps: InParamTuple + 'static> TypedSignal<'_, C, Ps> {
295293
/// #[godot_api]
296294
/// impl IControl for Tool {
297295
/// fn ready(&mut self) {
298-
/// self.button // Connect from other to self
296+
/// // Connect from other to self.
297+
/// self.button
299298
/// .signals()
300299
/// .pressed()
301300
/// .connect_other(self, Self::execute_tool);
302-
/// self.button // Connect from other to other (other_tool is OnEditor<Gd<OtherTool>>)
301+
///
302+
/// // Connect from other to other, where other_tool: OnEditor<Gd<OtherTool>>.
303+
/// self.button
303304
/// .signals()
304305
/// .pressed()
305306
/// .connect_other(&*self.other_tool, |tool| tool.set_tool_enabled(false));

0 commit comments

Comments
 (0)