@@ -261,8 +261,8 @@ pub trait IndexEnum: EngineEnum {
261261// Possible alternative for builder APIs, although even less ergonomic: Base<T> could be Base<T, Self> and return Gd<Self>. 
262262#[ diagnostic:: on_unimplemented(  
263263    message = "Class `{Self}` requires a `Base<T>` field" ,  
264-     label = "missing field `_base: Base<...>`" ,  
265-     note = "A base field is required to access the base from within `self`, for script-virtual functions or  #[rpc] methods " ,  
264+     label = "missing field `_base: Base<...>` in struct declaration " ,  
265+     note = "A base field is required to access the base from within `self`, as well as for  #[signal], #[ rpc] and #[func(virtual)] " ,  
266266    note = "see also: https://godot-rust.github.io/book/register/classes.html#the-base-field"  
267267) ] 
268268pub  trait  WithBaseField :  GodotClass  + Bounds < Declarer  = bounds:: DeclUser >  { 
@@ -428,6 +428,40 @@ pub trait WithBaseField: GodotClass + Bounds<Declarer = bounds::DeclUser> {
428428    } 
429429} 
430430
431+ pub  trait  WithSignals :  WithBaseField  { 
432+     type  SignalCollection < ' a > ; 
433+ 
434+     /// Access user-defined signals of the current object `self`. 
435+      /// 
436+      /// For classes that have at least one `#[signal]` defined, returns a collection of signal names. Each returned signal has a specialized 
437+      /// API for connecting and emitting signals in a type-safe way. If you need to access signals from outside (given a `Gd` pointer), use 
438+      /// [`Gd::signals()`] instead. 
439+      /// 
440+      /// If you haven't already, read the [book chapter about signals](https://godot-rust.github.io/book/register/signals.html) for a 
441+      /// walkthrough. 
442+      /// 
443+      /// # Provided API 
444+      /// 
445+      /// The returned collection provides a method for each signal, with the same name as the corresponding `#[signal]`.  \ 
446+      /// For example, if you have... 
447+      /// ```ignore 
448+      /// #[signal] 
449+      /// fn damage_taken(&mut self, amount: i32); 
450+      /// ``` 
451+      /// ...then you can access the signal as `self.signals().damage_taken()`, which returns an object with the following API: 
452+      /// 
453+      /// | Method signature | Description | 
454+      /// |------------------|-------------| 
455+      /// | `connect(f: impl FnMut(i32))` | Connects global or associated function, or a closure. | 
456+      /// | `connect_self(f: impl FnMut(&mut Self, i32))` | Connects a `&mut self` method or closure. | 
457+      /// | `emit(amount: i32)` | Emits the signal with the given arguments. | 
458+      /// 
459+      fn  signals ( & mut  self )  -> Self :: SignalCollection < ' _ > ; 
460+ 
461+     #[ doc( hidden) ]  
462+     fn  __signals_from_external ( external :  & Gd < Self > )  -> Self :: SignalCollection < ' _ > ; 
463+ } 
464+ 
431465/// Extension trait for all reference-counted classes. 
432466pub  trait  NewGd :  GodotClass  { 
433467    /// Return a new, ref-counted `Gd` containing a default-constructed instance. 
0 commit comments