@@ -87,6 +87,7 @@ impl_reflect_value!(isize(
87
87
) ) ;
88
88
impl_reflect_value ! ( f32 ( Debug , PartialEq , Serialize , Deserialize , Default ) ) ;
89
89
impl_reflect_value ! ( f64 ( Debug , PartialEq , Serialize , Deserialize , Default ) ) ;
90
+ impl_type_path ! ( str ) ;
90
91
impl_reflect_value ! ( :: alloc:: string:: String (
91
92
Debug ,
92
93
Hash ,
@@ -1071,8 +1072,6 @@ impl<T: TypePath + ?Sized> TypePath for &'static T {
1071
1072
static CELL : GenericTypePathCell = GenericTypePathCell :: new ( ) ;
1072
1073
CELL . get_or_insert :: < Self , _ > ( || format ! ( "&{}" , T :: short_type_path( ) ) )
1073
1074
}
1074
-
1075
- const TYPE_PATH_ID : TypePathId = TypePathId :: from_base ( "&" ) . with_generics ( & [ T :: TYPE_PATH_ID ] ) ;
1076
1075
}
1077
1076
1078
1077
impl Reflect for Cow < ' static , str > {
@@ -1179,8 +1178,6 @@ impl FromReflect for Cow<'static, str> {
1179
1178
}
1180
1179
}
1181
1180
1182
- impl < T : PathOnly > PathOnly for [ T ] where [ T ] : ToOwned { }
1183
-
1184
1181
impl < T : TypePath > TypePath for [ T ]
1185
1182
where
1186
1183
[ T ] : ToOwned ,
@@ -1196,8 +1193,6 @@ where
1196
1193
}
1197
1194
}
1198
1195
1199
- impl < T : ToOwned > PathOnly for T { }
1200
-
1201
1196
impl < T : FromReflect + Clone + TypePath > List for Cow < ' static , [ T ] > {
1202
1197
fn get ( & self , index : usize ) -> Option < & dyn Reflect > {
1203
1198
self . as_ref ( ) . get ( index) . map ( |x| x as & dyn Reflect )
@@ -1229,7 +1224,7 @@ impl<T: FromReflect + Clone + TypePath> List for Cow<'static, [T]> {
1229
1224
T :: from_reflect ( & * value) . unwrap_or_else ( || {
1230
1225
panic ! (
1231
1226
"Attempted to insert invalid value of type {}." ,
1232
- value. type_name ( )
1227
+ value. reflect_type_path ( )
1233
1228
)
1234
1229
} )
1235
1230
} ) ;
@@ -1244,7 +1239,7 @@ impl<T: FromReflect + Clone + TypePath> List for Cow<'static, [T]> {
1244
1239
let value = T :: take_from_reflect ( value) . unwrap_or_else ( |value| {
1245
1240
panic ! (
1246
1241
"Attempted to push invalid value of type {}." ,
1247
- value. type_name ( )
1242
+ value. reflect_type_path ( )
1248
1243
)
1249
1244
} ) ;
1250
1245
self . to_mut ( ) . push ( value) ;
@@ -1258,10 +1253,6 @@ impl<T: FromReflect + Clone + TypePath> List for Cow<'static, [T]> {
1258
1253
}
1259
1254
1260
1255
impl < T : FromReflect + Clone + TypePath > Reflect for Cow < ' static , [ T ] > {
1261
- fn type_name ( & self ) -> & str {
1262
- std:: any:: type_name :: < Self > ( )
1263
- }
1264
-
1265
1256
fn into_any ( self : Box < Self > ) -> Box < dyn Any > {
1266
1257
self
1267
1258
}
@@ -1434,18 +1425,6 @@ impl Typed for &'static Path {
1434
1425
}
1435
1426
}
1436
1427
1437
- impl TypePath for & ' static Path {
1438
- fn type_path ( ) -> & ' static str {
1439
- static CELL : GenericTypePathCell = GenericTypePathCell :: new ( ) ;
1440
- CELL . get_or_insert :: < Self , _ > ( || "&std::path::Path" . to_owned ( ) )
1441
- }
1442
-
1443
- fn short_type_path ( ) -> & ' static str {
1444
- static CELL : GenericTypePathCell = GenericTypePathCell :: new ( ) ;
1445
- CELL . get_or_insert :: < Self , _ > ( || "&Path" . to_owned ( ) )
1446
- }
1447
- }
1448
-
1449
1428
impl GetTypeRegistration for & ' static Path {
1450
1429
fn get_type_registration ( ) -> TypeRegistration {
1451
1430
let mut registration = TypeRegistration :: of :: < Self > ( ) ;
@@ -1547,6 +1526,7 @@ impl Typed for Cow<'static, Path> {
1547
1526
}
1548
1527
}
1549
1528
1529
+ impl_type_path ! ( :: std:: path:: Path ) ;
1550
1530
impl_type_path ! ( :: alloc:: borrow:: Cow <' a: ' static , T : ToOwned + ?Sized >) ;
1551
1531
1552
1532
impl FromReflect for Cow < ' static , Path > {
0 commit comments