@@ -38,12 +38,18 @@ pub fn make_class_signals(
38
38
. zip ( all_params. iter ( ) )
39
39
. map ( |( signal, params) | make_signal_individual_struct ( signal, params) ) ;
40
40
41
+ let class_name = class. name ( ) ;
42
+
41
43
Some ( quote ! {
42
44
#[ cfg( since_api = "4.2" ) ]
43
45
pub use signals:: * ;
44
46
45
47
#[ cfg( since_api = "4.2" ) ]
46
48
mod signals {
49
+ use crate :: obj:: Gd ;
50
+ use super :: re_export:: #class_name;
51
+ use super :: * ;
52
+
47
53
#signal_collection_struct
48
54
#( #signal_types ) *
49
55
}
@@ -93,17 +99,17 @@ fn make_signal_collection(
93
99
quote ! {
94
100
#[ doc = #collection_docs]
95
101
pub struct #collection_struct_name<' c> {
96
- __gd: & ' c mut Gd <re_export :: #class_name>,
102
+ __gd: & ' c mut Gd <#class_name>,
97
103
}
98
104
99
105
impl <' c> #collection_struct_name<' c> {
100
106
#( #provider_methods ) *
101
107
}
102
108
103
- impl crate :: obj:: WithSignals for re_export :: #class_name {
109
+ impl crate :: obj:: WithSignals for #class_name {
104
110
type SignalCollection <' c> = #collection_struct_name<' c>;
105
111
#[ doc( hidden) ]
106
- type __SignalObject<' c> = Gd <re_export :: #class_name>;
112
+ type __SignalObject<' c> = Gd <#class_name>;
107
113
108
114
#[ doc( hidden) ]
109
115
fn __signals_from_external( external: & mut Gd <Self >) -> Self :: SignalCollection <' _> {
@@ -126,26 +132,27 @@ fn make_signal_individual_struct(signal: &ClassSignal, params: &SignalParams) ->
126
132
} = params;
127
133
128
134
let class_name = & signal. surrounding_class ;
129
- let class_ty = quote ! { re_export :: #class_name } ;
135
+ let class_ty = quote ! { #class_name } ;
130
136
let param_tuple = quote ! { ( #type_list ) } ;
137
+ let typed_name = format_ident ! ( "Typed{}" , individual_struct_name) ;
131
138
132
139
// Embedded in `mod signals`.
133
140
quote ! {
141
+ // Reduce tokens to parse by reusing this type definitions.
142
+ type #typed_name<' c> = crate :: registry:: signal:: TypedSignal <' c, #class_ty, #param_tuple>;
143
+
134
144
pub struct #individual_struct_name<' c> {
135
- typed: Self :: TypedSignal ,
145
+ typed: #typed_name< ' c> ,
136
146
}
137
147
138
148
impl <' c> #individual_struct_name<' c> {
139
- type ParamTuple = #param_tuple;
140
- type TypedSignal = crate :: registry:: signal:: TypedSignal <' c, #class_ty, Self :: ParamTuple >;
141
-
142
149
pub fn emit( & mut self , #param_list) {
143
150
self . typed. emit_tuple( ( #name_list) ) ;
144
151
}
145
152
}
146
153
147
154
impl <' c> std:: ops:: Deref for #individual_struct_name<' c> {
148
- type Target = Self :: TypedSignal ;
155
+ type Target = #typed_name< ' c> ;
149
156
150
157
fn deref( & self ) -> & Self :: Target {
151
158
& self . typed
0 commit comments