@@ -2,7 +2,6 @@ use std::fmt::Display;
22use std:: fmt:: { Debug , Formatter , Result as FmtResult } ;
33use std:: hash:: { Hash , Hasher } ;
44use std:: marker:: PhantomData ;
5- use std:: mem;
65use std:: num:: NonZeroU32 ;
76
87use crate :: error:: EcsError ;
@@ -539,44 +538,28 @@ where
539538impl < ' a , A : Archetype > From < & ' a Entity < A > > for & ' a EntityAny {
540539 #[ inline( always) ]
541540 fn from ( value : & ' a Entity < A > ) -> Self {
542- unsafe {
543- // SAFETY: Entity<A> is a transparent struct containing only an EntityAny,
544- // which guarantees that they have the same representation in memory
545- mem:: transmute ( value)
546- }
541+ & value. inner
547542 }
548543}
549544
550545impl < ' a , A : Archetype > From < & ' a EntityDirect < A > > for & ' a EntityDirectAny {
551546 #[ inline( always) ]
552547 fn from ( value : & ' a EntityDirect < A > ) -> Self {
553- unsafe {
554- // SAFETY: EntityDirect<A> is a transparent struct containing only an EntityDirectAny,
555- // which guarantees that they have the same representation in memory
556- mem:: transmute ( value)
557- }
548+ & value. inner
558549 }
559550}
560551
561552impl < ' a , A : Archetype > From < & ' a mut Entity < A > > for & ' a mut EntityAny {
562553 #[ inline( always) ]
563554 fn from ( value : & ' a mut Entity < A > ) -> Self {
564- unsafe {
565- // SAFETY: Entity<A> is a transparent struct containing only an EntityAny,
566- // which guarantees that they have the same representation in memory
567- mem:: transmute ( value)
568- }
555+ & mut value. inner
569556 }
570557}
571558
572559impl < ' a , A : Archetype > From < & ' a mut EntityDirect < A > > for & ' a mut EntityDirectAny {
573560 #[ inline( always) ]
574561 fn from ( value : & ' a mut EntityDirect < A > ) -> Self {
575- unsafe {
576- // SAFETY: EntityDirect<A> is a transparent struct containing only an EntityDirectAny,
577- // which guarantees that they have the same representation in memory
578- mem:: transmute ( value)
579- }
562+ & mut value. inner
580563 }
581564}
582565
0 commit comments