@@ -26,15 +26,15 @@ use crate::{
26
26
/// - `Query<&mut dyn Trait>` yields a [`WriteTraits`] object
27
27
pub struct All < T : ?Sized > ( T ) ;
28
28
29
- unsafe impl < ' a , Trait : ?Sized + TraitQuery > QueryData for All < & ' a Trait > {
29
+ unsafe impl < Trait : ?Sized + TraitQuery > QueryData for All < & Trait > {
30
30
type ReadOnly = Self ;
31
31
}
32
- unsafe impl < ' a , Trait : ?Sized + TraitQuery > ReadOnlyQueryData for All < & ' a Trait > { }
32
+ unsafe impl < Trait : ?Sized + TraitQuery > ReadOnlyQueryData for All < & Trait > { }
33
33
34
34
// SAFETY: We only access the components registered in the trait registry.
35
35
// This is known to match the set of components in the TraitQueryState,
36
36
// which is used to match archetypes and register world access.
37
- unsafe impl < ' a , Trait : ?Sized + TraitQuery > WorldQuery for All < & ' a Trait > {
37
+ unsafe impl < Trait : ?Sized + TraitQuery > WorldQuery for All < & Trait > {
38
38
type Item < ' w > = ReadTraits < ' w , Trait > ;
39
39
type Fetch < ' w > = AllTraitsFetch < ' w , Trait > ;
40
40
type State = TraitQueryState < Trait > ;
@@ -109,18 +109,18 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for All<&'a Trait> {
109
109
let mut new_access = access. clone ( ) ;
110
110
for & component in & * state. components {
111
111
assert ! (
112
- !access. access( ) . has_write ( component) ,
112
+ !access. access( ) . has_component_write ( component) ,
113
113
"&{} conflicts with a previous access in this query. Shared access cannot coincide with exclusive access." ,
114
114
std:: any:: type_name:: <Trait >( ) ,
115
115
) ;
116
116
if not_first {
117
117
let mut intermediate = access. clone ( ) ;
118
- intermediate. add_read ( component) ;
118
+ intermediate. add_component_read ( component) ;
119
119
new_access. append_or ( & intermediate) ;
120
120
new_access. extend_access ( & intermediate) ;
121
121
} else {
122
122
new_access. and_with ( component) ;
123
- new_access. access_mut ( ) . add_read ( component) ;
123
+ new_access. access_mut ( ) . add_component_read ( component) ;
124
124
not_first = true ;
125
125
}
126
126
}
@@ -145,6 +145,11 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for All<&'a Trait> {
145
145
) -> bool {
146
146
state. matches_component_set_any ( set_contains_id)
147
147
}
148
+
149
+ #[ inline]
150
+ fn shrink_fetch < ' wlong : ' wshort , ' wshort > ( fetch : Self :: Fetch < ' wlong > ) -> Self :: Fetch < ' wshort > {
151
+ fetch
152
+ }
148
153
}
149
154
150
155
unsafe impl < ' a , Trait : ?Sized + TraitQuery > QueryData for All < & ' a mut Trait > {
@@ -154,7 +159,7 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> QueryData for All<&'a mut Trait> {
154
159
// SAFETY: We only access the components registered in the trait registry.
155
160
// This is known to match the set of components in the TraitQueryState,
156
161
// which is used to match archetypes and register world access.
157
- unsafe impl < ' a , Trait : ?Sized + TraitQuery > WorldQuery for All < & ' a mut Trait > {
162
+ unsafe impl < Trait : ?Sized + TraitQuery > WorldQuery for All < & mut Trait > {
158
163
type Item < ' w > = WriteTraits < ' w , Trait > ;
159
164
type Fetch < ' w > = AllTraitsFetch < ' w , Trait > ;
160
165
type State = TraitQueryState < Trait > ;
@@ -230,18 +235,18 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for All<&'a mut Trait> {
230
235
let mut new_access = access. clone ( ) ;
231
236
for & component in & * state. components {
232
237
assert ! (
233
- !access. access( ) . has_write ( component) ,
238
+ !access. access( ) . has_component_write ( component) ,
234
239
"&mut {} conflicts with a previous access in this query. Mutable component access must be unique." ,
235
240
std:: any:: type_name:: <Trait >( ) ,
236
241
) ;
237
242
if not_first {
238
243
let mut intermediate = access. clone ( ) ;
239
- intermediate. add_write ( component) ;
244
+ intermediate. add_component_write ( component) ;
240
245
new_access. append_or ( & intermediate) ;
241
246
new_access. extend_access ( & intermediate) ;
242
247
} else {
243
248
new_access. and_with ( component) ;
244
- new_access. access_mut ( ) . add_write ( component) ;
249
+ new_access. access_mut ( ) . add_component_write ( component) ;
245
250
not_first = true ;
246
251
}
247
252
}
@@ -266,4 +271,9 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> WorldQuery for All<&'a mut Trait> {
266
271
) -> bool {
267
272
state. matches_component_set_any ( set_contains_id)
268
273
}
274
+
275
+ #[ inline]
276
+ fn shrink_fetch < ' wlong : ' wshort , ' wshort > ( fetch : Self :: Fetch < ' wlong > ) -> Self :: Fetch < ' wshort > {
277
+ fetch
278
+ }
269
279
}
0 commit comments