@@ -120,7 +120,7 @@ pub fn derive_entity_event(input: TokenStream) -> TokenStream {
120
120
. into ( ) ;
121
121
}
122
122
123
- let entity_field = match get_entity_event_field ( & ast) {
123
+ let entity_field = match get_event_target_field ( & ast) {
124
124
Ok ( value) => value,
125
125
Err ( err) => return err. into_compile_error ( ) . into ( ) ,
126
126
} ;
@@ -143,21 +143,21 @@ pub fn derive_entity_event(input: TokenStream) -> TokenStream {
143
143
}
144
144
145
145
impl #impl_generics #bevy_ecs_path:: event:: EntityEvent for #struct_name #type_generics #where_clause {
146
- fn entity ( & self ) -> #bevy_ecs_path:: entity:: Entity {
146
+ fn event_target ( & self ) -> #bevy_ecs_path:: entity:: Entity {
147
147
self . #entity_field
148
148
}
149
149
150
- fn entity_mut ( & mut self ) -> & mut #bevy_ecs_path:: entity:: Entity {
150
+ fn event_target_mut ( & mut self ) -> & mut #bevy_ecs_path:: entity:: Entity {
151
151
& mut self . #entity_field
152
152
}
153
153
}
154
154
155
155
} )
156
156
}
157
157
158
- /// Returns the field with the `#[event_entity ]` attribute, the only field if unnamed,
158
+ /// Returns the field with the `#[event_target ]` attribute, the only field if unnamed,
159
159
/// or the field with the name "entity".
160
- fn get_entity_event_field ( ast : & DeriveInput ) -> Result < Member > {
160
+ fn get_event_target_field ( ast : & DeriveInput ) -> Result < Member > {
161
161
let Data :: Struct ( DataStruct { fields, .. } ) = & ast. data else {
162
162
return Err ( syn:: Error :: new (
163
163
ast. span ( ) ,
@@ -169,29 +169,29 @@ fn get_entity_event_field(ast: &DeriveInput) -> Result<Member> {
169
169
if field. ident . as_ref ( ) . is_some_and ( |i| i == "entity" ) || field
170
170
. attrs
171
171
. iter ( )
172
- . any ( |attr| attr. path ( ) . is_ident ( EVENT_ENTITY ) ) {
172
+ . any ( |attr| attr. path ( ) . is_ident ( EVENT_TARGET ) ) {
173
173
Some ( Member :: Named ( field. ident . clone ( ) ?) )
174
174
} else {
175
175
None
176
176
}
177
177
} ) . ok_or ( syn:: Error :: new (
178
178
fields. span ( ) ,
179
- "EntityEvent derive expected a field name 'entity' or a field annotated with #[event_entity ]."
179
+ "EntityEvent derive expected a field name 'entity' or a field annotated with #[event_target ]."
180
180
) ) ,
181
181
Fields :: Unnamed ( fields) if fields. unnamed . len ( ) == 1 => Ok ( Member :: Unnamed ( Index :: from ( 0 ) ) ) ,
182
182
Fields :: Unnamed ( fields) => fields. unnamed . iter ( ) . enumerate ( ) . find_map ( |( index, field) | {
183
183
if field
184
184
. attrs
185
185
. iter ( )
186
- . any ( |attr| attr. path ( ) . is_ident ( EVENT_ENTITY ) ) {
186
+ . any ( |attr| attr. path ( ) . is_ident ( EVENT_TARGET ) ) {
187
187
Some ( Member :: Unnamed ( Index :: from ( index) ) )
188
188
} else {
189
189
None
190
190
}
191
191
} )
192
192
. ok_or ( syn:: Error :: new (
193
193
fields. span ( ) ,
194
- "EntityEvent derive expected unnamed structs with one field or with a field annotated with #[event_entity ]." ,
194
+ "EntityEvent derive expected unnamed structs with one field or with a field annotated with #[event_target ]." ,
195
195
) ) ,
196
196
Fields :: Unit => Err ( syn:: Error :: new (
197
197
fields. span ( ) ,
@@ -536,7 +536,7 @@ pub const STORAGE: &str = "storage";
536
536
pub const REQUIRE : & str = "require" ;
537
537
pub const RELATIONSHIP : & str = "relationship" ;
538
538
pub const RELATIONSHIP_TARGET : & str = "relationship_target" ;
539
- pub const EVENT_ENTITY : & str = "event_entity " ;
539
+ pub const EVENT_TARGET : & str = "event_target " ;
540
540
541
541
pub const ON_ADD : & str = "on_add" ;
542
542
pub const ON_INSERT : & str = "on_insert" ;
0 commit comments