@@ -3,12 +3,13 @@ use crate::utility::{
3
3
reflect_hasher, GenericTypeInfoCell , GenericTypePathCell , NonGenericTypeInfoCell ,
4
4
} ;
5
5
use crate :: {
6
- self as bevy_reflect, impl_type_path, map_apply, map_partial_eq, map_try_apply, set_apply,
7
- set_partial_eq, set_try_apply, ApplyError , Array , ArrayInfo , ArrayIter , DynamicMap , DynamicSet ,
8
- DynamicTypePath , FromReflect , FromType , GetTypeRegistration , List , ListInfo , ListIter , Map ,
9
- MapInfo , MapIter , MaybeTyped , PartialReflect , Reflect , ReflectDeserialize , ReflectFromPtr ,
10
- ReflectFromReflect , ReflectKind , ReflectMut , ReflectOwned , ReflectRef , ReflectSerialize , Set ,
11
- SetInfo , TypeInfo , TypePath , TypeRegistration , TypeRegistry , Typed , ValueInfo ,
6
+ self as bevy_reflect, impl_type_path, map_apply, map_partial_eq, map_try_apply,
7
+ reflect:: impl_full_reflect, set_apply, set_partial_eq, set_try_apply, ApplyError , Array ,
8
+ ArrayInfo , ArrayIter , DynamicMap , DynamicSet , DynamicTypePath , FromReflect , FromType ,
9
+ GetTypeRegistration , List , ListInfo , ListIter , Map , MapInfo , MapIter , MaybeTyped ,
10
+ PartialReflect , Reflect , ReflectDeserialize , ReflectFromPtr , ReflectFromReflect , ReflectKind ,
11
+ ReflectMut , ReflectOwned , ReflectRef , ReflectSerialize , Set , SetInfo , TypeInfo , TypePath ,
12
+ TypeRegistration , TypeRegistry , Typed , ValueInfo ,
12
13
} ;
13
14
use bevy_reflect_derive:: { impl_reflect, impl_reflect_value} ;
14
15
use std:: fmt;
@@ -514,36 +515,7 @@ macro_rules! impl_reflect_for_veclike {
514
515
}
515
516
}
516
517
517
- impl <T : FromReflect + MaybeTyped + TypePath + GetTypeRegistration > Reflect for $ty {
518
- fn into_any( self : Box <Self >) -> Box <dyn Any > {
519
- self
520
- }
521
-
522
- fn as_any( & self ) -> & dyn Any {
523
- self
524
- }
525
-
526
- fn as_any_mut( & mut self ) -> & mut dyn Any {
527
- self
528
- }
529
-
530
- fn into_reflect( self : Box <Self >) -> Box <dyn Reflect > {
531
- self
532
- }
533
-
534
- fn as_reflect( & self ) -> & dyn Reflect {
535
- self
536
- }
537
-
538
- fn as_reflect_mut( & mut self ) -> & mut dyn Reflect {
539
- self
540
- }
541
-
542
- fn set( & mut self , value: Box <dyn Reflect >) -> Result <( ) , Box <dyn Reflect >> {
543
- * self = value. take( ) ?;
544
- Ok ( ( ) )
545
- }
546
- }
518
+ impl_full_reflect!( <T > for $ty where T : FromReflect + MaybeTyped + TypePath + GetTypeRegistration ) ;
547
519
548
520
impl <T : FromReflect + MaybeTyped + TypePath + GetTypeRegistration > Typed for $ty {
549
521
fn type_info( ) -> & ' static TypeInfo {
@@ -1239,41 +1211,13 @@ where
1239
1211
map_try_apply ( self , value)
1240
1212
}
1241
1213
}
1242
- impl < K , V > Reflect for :: std:: collections:: BTreeMap < K , V >
1243
- where
1244
- K : FromReflect + MaybeTyped + TypePath + GetTypeRegistration + Eq + Ord ,
1245
- V : FromReflect + MaybeTyped + TypePath + GetTypeRegistration ,
1246
- {
1247
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
1248
- self
1249
- }
1250
1214
1251
- fn as_any ( & self ) -> & dyn Any {
1252
- self
1253
- }
1254
-
1255
- fn as_any_mut ( & mut self ) -> & mut dyn Any {
1256
- self
1257
- }
1258
-
1259
- #[ inline]
1260
- fn into_reflect ( self : Box < Self > ) -> Box < dyn Reflect > {
1261
- self
1262
- }
1263
-
1264
- fn as_reflect ( & self ) -> & dyn Reflect {
1265
- self
1266
- }
1267
-
1268
- fn as_reflect_mut ( & mut self ) -> & mut dyn Reflect {
1269
- self
1270
- }
1271
-
1272
- fn set ( & mut self , value : Box < dyn Reflect > ) -> Result < ( ) , Box < dyn Reflect > > {
1273
- * self = value. take ( ) ?;
1274
- Ok ( ( ) )
1275
- }
1276
- }
1215
+ impl_full_reflect ! (
1216
+ <K , V > for :: std:: collections:: BTreeMap <K , V >
1217
+ where
1218
+ K : FromReflect + MaybeTyped + TypePath + GetTypeRegistration + Eq + Ord ,
1219
+ V : FromReflect + MaybeTyped + TypePath + GetTypeRegistration ,
1220
+ ) ;
1277
1221
1278
1222
impl < K , V > Typed for :: std:: collections:: BTreeMap < K , V >
1279
1223
where
@@ -1644,36 +1588,7 @@ impl PartialReflect for Cow<'static, str> {
1644
1588
}
1645
1589
}
1646
1590
1647
- impl Reflect for Cow < ' static , str > {
1648
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
1649
- self
1650
- }
1651
-
1652
- fn as_any ( & self ) -> & dyn Any {
1653
- self
1654
- }
1655
-
1656
- fn as_any_mut ( & mut self ) -> & mut dyn Any {
1657
- self
1658
- }
1659
-
1660
- fn into_reflect ( self : Box < Self > ) -> Box < dyn Reflect > {
1661
- self
1662
- }
1663
-
1664
- fn as_reflect ( & self ) -> & dyn Reflect {
1665
- self
1666
- }
1667
-
1668
- fn as_reflect_mut ( & mut self ) -> & mut dyn Reflect {
1669
- self
1670
- }
1671
-
1672
- fn set ( & mut self , value : Box < dyn Reflect > ) -> Result < ( ) , Box < dyn Reflect > > {
1673
- * self = value. take ( ) ?;
1674
- Ok ( ( ) )
1675
- }
1676
- }
1591
+ impl_full_reflect ! ( for Cow <' static , str >) ;
1677
1592
1678
1593
impl Typed for Cow < ' static , str > {
1679
1594
fn type_info ( ) -> & ' static TypeInfo {
@@ -1846,38 +1761,11 @@ impl<T: FromReflect + MaybeTyped + Clone + TypePath + GetTypeRegistration> Parti
1846
1761
}
1847
1762
}
1848
1763
1849
- impl < T : FromReflect + Clone + MaybeTyped + TypePath + GetTypeRegistration > Reflect
1850
- for Cow < ' static , [ T ] >
1851
- {
1852
- fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
1853
- self
1854
- }
1855
-
1856
- fn as_any ( & self ) -> & dyn Any {
1857
- self
1858
- }
1859
-
1860
- fn as_any_mut ( & mut self ) -> & mut dyn Any {
1861
- self
1862
- }
1863
-
1864
- fn into_reflect ( self : Box < Self > ) -> Box < dyn Reflect > {
1865
- self
1866
- }
1867
-
1868
- fn as_reflect ( & self ) -> & dyn Reflect {
1869
- self
1870
- }
1871
-
1872
- fn as_reflect_mut ( & mut self ) -> & mut dyn Reflect {
1873
- self
1874
- }
1875
-
1876
- fn set ( & mut self , value : Box < dyn Reflect > ) -> Result < ( ) , Box < dyn Reflect > > {
1877
- * self = value. take ( ) ?;
1878
- Ok ( ( ) )
1879
- }
1880
- }
1764
+ impl_full_reflect ! (
1765
+ <T > for Cow <' static , [ T ] >
1766
+ where
1767
+ T : FromReflect + Clone + MaybeTyped + TypePath + GetTypeRegistration ,
1768
+ ) ;
1881
1769
1882
1770
impl < T : FromReflect + MaybeTyped + Clone + TypePath + GetTypeRegistration > Typed
1883
1771
for Cow < ' static , [ T ] >
0 commit comments