@@ -27,6 +27,7 @@ unsafe impl<Trait: ?Sized + TraitQuery> QueryData for One<&Trait> {
2727 type ReadOnly = Self ;
2828
2929 const IS_READ_ONLY : bool = true ;
30+ const IS_ARCHETYPAL : bool = false ;
3031
3132 type Item < ' w , ' s > = Ref < ' w , Trait > ;
3233
@@ -43,7 +44,7 @@ unsafe impl<Trait: ?Sized + TraitQuery> QueryData for One<&Trait> {
4344 fetch : & mut Self :: Fetch < ' w > ,
4445 entity : Entity ,
4546 table_row : TableRow ,
46- ) -> Self :: Item < ' w , ' s > {
47+ ) -> Option < Self :: Item < ' w , ' s > > {
4748 unsafe {
4849 let table_row = table_row. index ( ) ;
4950 let ( dyn_ctor, ptr, added, changed, location) = match fetch. storage {
@@ -69,7 +70,7 @@ unsafe impl<Trait: ?Sized + TraitQuery> QueryData for One<&Trait> {
6970 )
7071 }
7172 FetchStorage :: SparseSet { components, meta } => {
72- let ( ptr, ticks, location ) = components
73+ let ( ptr, ticks) = components
7374 . get_with_ticks ( entity)
7475 . unwrap_or_else ( || debug_unreachable ( ) ) ;
7576 (
@@ -79,21 +80,27 @@ unsafe impl<Trait: ?Sized + TraitQuery> QueryData for One<&Trait> {
7980 // we have access to the corresponding `ComponentTicks`.
8081 ticks. added . deref ( ) ,
8182 ticks. changed . deref ( ) ,
82- location ,
83+ ticks . changed_by ,
8384 )
8485 }
8586 } ;
8687
87- Ref :: new (
88+ Some ( Ref :: new (
8889 dyn_ctor. cast ( ptr) ,
8990 added,
9091 changed,
9192 fetch. last_run ,
9293 fetch. this_run ,
9394 location. map ( |loc| loc. deref ( ) ) ,
94- )
95+ ) )
9596 }
9697 }
98+
99+ fn iter_access (
100+ _state : & Self :: State ,
101+ ) -> impl Iterator < Item = bevy_ecs:: query:: EcsAccessType < ' _ > > {
102+ std:: iter:: empty ( )
103+ }
97104}
98105
99106unsafe impl < Trait : ?Sized + TraitQuery > ReadOnlyQueryData for One < & Trait > { }
@@ -236,6 +243,7 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> QueryData for One<&'a mut Trait> {
236243 type ReadOnly = One < & ' a Trait > ;
237244
238245 const IS_READ_ONLY : bool = false ;
246+ const IS_ARCHETYPAL : bool = false ;
239247
240248 type Item < ' w , ' s > = Mut < ' w , Trait > ;
241249
@@ -252,7 +260,7 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> QueryData for One<&'a mut Trait> {
252260 fetch : & mut Self :: Fetch < ' w > ,
253261 entity : Entity ,
254262 table_row : TableRow ,
255- ) -> Mut < ' w , Trait > {
263+ ) -> Option < Mut < ' w , Trait > > {
256264 unsafe {
257265 let table_row = table_row. index ( ) ;
258266 let ( dyn_ctor, ptr, added, changed, location) = match fetch. storage {
@@ -281,7 +289,7 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> QueryData for One<&'a mut Trait> {
281289 )
282290 }
283291 FetchStorage :: SparseSet { components, meta } => {
284- let ( ptr, ticks, location ) = components
292+ let ( ptr, ticks) = components
285293 . get_with_ticks ( entity)
286294 . unwrap_or_else ( || debug_unreachable ( ) ) ;
287295 (
@@ -294,21 +302,27 @@ unsafe impl<'a, Trait: ?Sized + TraitQuery> QueryData for One<&'a mut Trait> {
294302 // we have exclusive access to the corresponding `ComponentTicks`.
295303 ticks. added . deref_mut ( ) ,
296304 ticks. changed . deref_mut ( ) ,
297- location ,
305+ ticks . changed_by ,
298306 )
299307 }
300308 } ;
301309
302- Mut :: new (
310+ Some ( Mut :: new (
303311 dyn_ctor. cast_mut ( ptr) ,
304312 added,
305313 changed,
306314 fetch. last_run ,
307315 fetch. this_run ,
308316 location. map ( |loc| loc. deref_mut ( ) ) ,
309- )
317+ ) )
310318 }
311319 }
320+
321+ fn iter_access (
322+ _state : & Self :: State ,
323+ ) -> impl Iterator < Item = bevy_ecs:: query:: EcsAccessType < ' _ > > {
324+ std:: iter:: empty ( )
325+ }
312326}
313327
314328// SAFETY: We only access the components registered in TraitQueryState.
0 commit comments