@@ -6,8 +6,8 @@ use std::mem;
66use std:: num:: NonZeroU32 ;
77
88use crate :: error:: EcsError ;
9- use crate :: index:: { TrimmedIndex , MAX_DATA_INDEX } ;
10- use crate :: traits:: { Archetype , ArchetypeCanResolve , EntityKey , EntityKeyTyped } ;
9+ use crate :: index:: { MAX_DATA_INDEX , TrimmedIndex } ;
10+ use crate :: traits:: * ;
1111use crate :: version:: { ArchetypeVersion , SlotVersion } ;
1212
1313// NOTE: While this is extremely unlikely to change, if it does, the proc
@@ -488,6 +488,54 @@ impl EntityKey for EntityDirectAny {
488488 type DirectOutput = EntityDirectAny ;
489489}
490490
491+ impl < ' a , A : Archetype + ' a , W : World > EntityKeySelectable < ' a , W > for Entity < A >
492+ where
493+ W : WorldHas < A > ,
494+ {
495+ type View = <A as Archetype >:: View < ' a > ;
496+ type ViewMut = <A as Archetype >:: ViewMut < ' a > ;
497+ type Borrow = <A as Archetype >:: Borrow < ' a > ;
498+
499+ #[ inline( always) ]
500+ fn resolve_view ( self , world : & ' a mut W ) -> Option < Self :: View > {
501+ world. archetype_mut :: < A > ( ) . view ( self )
502+ }
503+
504+ #[ inline( always) ]
505+ fn resolve_view_mut ( self , world : & ' a mut W ) -> Option < Self :: ViewMut > {
506+ world. archetype_mut :: < A > ( ) . view_mut ( self )
507+ }
508+
509+ #[ inline( always) ]
510+ fn resolve_borrow ( self , world : & ' a W ) -> Option < Self :: Borrow > {
511+ world. archetype :: < A > ( ) . borrow ( self )
512+ }
513+ }
514+
515+ impl < ' a , A : Archetype + ' a , W : World > EntityKeySelectable < ' a , W > for EntityDirect < A >
516+ where
517+ W : WorldHas < A > ,
518+ {
519+ type View = <A as Archetype >:: View < ' a > ;
520+ type ViewMut = <A as Archetype >:: ViewMut < ' a > ;
521+ type Borrow = <A as Archetype >:: Borrow < ' a > ;
522+
523+ #[ inline( always) ]
524+ fn resolve_view ( self , world : & ' a mut W ) -> Option < Self :: View > {
525+ world. archetype_mut :: < A > ( ) . view ( self )
526+ }
527+
528+ #[ inline( always) ]
529+ fn resolve_view_mut ( self , world : & ' a mut W ) -> Option < Self :: ViewMut > {
530+ world. archetype_mut :: < A > ( ) . view_mut ( self )
531+ }
532+
533+ #[ inline( always) ]
534+ fn resolve_borrow ( self , world : & ' a W ) -> Option < Self :: Borrow > {
535+ world. archetype :: < A > ( ) . borrow ( self )
536+ }
537+ }
538+
491539impl < ' a , A : Archetype > From < & ' a Entity < A > > for & ' a EntityAny {
492540 #[ inline( always) ]
493541 fn from ( value : & ' a Entity < A > ) -> Self {
0 commit comments