@@ -185,8 +185,8 @@ pub enum FromReflectError {
185
185
186
186
/// The source type did not have a field at index given by the parameter `index`.
187
187
///
188
- /// This error is given by types of [kind](ReflectKind) [`TupleStruct`](crate::TupleStruct) and
189
- /// [`Enum`](crate::Enum).
188
+ /// This error is given by types of [kind](ReflectKind) [`TupleStruct`](crate::TupleStruct),
189
+ /// [`Tuple`](crate::Tuple) and [` Enum`](crate::Enum).
190
190
#[ error( "The reflected type `{}` of kind {} cannot be converted to type `{}` due to a missing field at index {}" ,
191
191
. from_type. type_name( ) , self . display_from_kind( ) , . to_type. type_name( ) , . index) ]
192
192
MissingUnnamedField {
@@ -203,25 +203,6 @@ pub enum FromReflectError {
203
203
index : usize ,
204
204
} ,
205
205
206
- /// The source type did not have a value at index given by the parameter `index`.
207
- ///
208
- /// This error is given by types of [kind](ReflectKind) [`Tuple`](crate::Tuple).
209
- #[ error( "The reflected type `{}` of kind {} cannot be converted to type `{}` due to a missing value at index {}" ,
210
- . from_type. type_name( ) , self . display_from_kind( ) , . to_type. type_name( ) , . index) ]
211
- MissingIndex {
212
- /// [`TypeInfo`] of the source type.
213
- from_type : & ' static TypeInfo ,
214
-
215
- /// [`ReflectKind`] of the source type.
216
- from_kind : ReflectKind ,
217
-
218
- /// [`TypeInfo`] of the target type.
219
- to_type : & ' static TypeInfo ,
220
-
221
- /// Index of missing value in source type.
222
- index : usize ,
223
- } ,
224
-
225
206
/// The target type did not have a variant with name given by the parameter `variant`.
226
207
///
227
208
/// This error is given by types of [kind](ReflectKind) [`Enum`](crate::Enum).
@@ -270,8 +251,8 @@ pub enum FromReflectError {
270
251
///
271
252
/// Use [`Error::source`](std::error::Error::source) to get the underlying error.
272
253
///
273
- /// This error is given by types of [kind](ReflectKind) [`TupleStruct`](crate::TupleStruct)
274
- /// and [`Enum`](crate::Enum).
254
+ /// This error is given by types of [kind](ReflectKind) [`TupleStruct`](crate::TupleStruct),
255
+ /// [`Tuple`](crate::Tuple) and [`Enum`](crate::Enum).
275
256
#[ error( "The reflected type `{}` of kind {} cannot be converted to type `{}` due to an error in the field at index {}" ,
276
257
. from_type. type_name( ) , self . display_from_kind( ) , . to_type. type_name( ) , . index) ]
277
258
UnnamedFieldError {
@@ -296,7 +277,7 @@ pub enum FromReflectError {
296
277
/// Use [`Error::source`](std::error::Error::source) to get the underlying error.
297
278
///
298
279
/// This error is given by types of [kind](ReflectKind) [`List`](crate::List) and
299
- /// [`Enum `](crate::Enum ).
280
+ /// [`Array `](crate::Array ).
300
281
#[ error( "The reflected type `{}` of kind {} cannot be converted to type `{}` due to an error in the value at index `{}`" ,
301
282
. from_type. type_name( ) , self . display_from_kind( ) , . to_type. type_name( ) , . index) ]
302
283
IndexError {
@@ -391,7 +372,6 @@ impl FromReflectError {
391
372
| Self :: InvalidLength { from_type, .. }
392
373
| Self :: MissingNamedField { from_type, .. }
393
374
| Self :: MissingUnnamedField { from_type, .. }
394
- | Self :: MissingIndex { from_type, .. }
395
375
| Self :: MissingVariant { from_type, .. }
396
376
| Self :: NamedFieldError { from_type, .. }
397
377
| Self :: UnnamedFieldError { from_type, .. }
@@ -409,7 +389,6 @@ impl FromReflectError {
409
389
| Self :: InvalidLength { to_type, .. }
410
390
| Self :: MissingNamedField { to_type, .. }
411
391
| Self :: MissingUnnamedField { to_type, .. }
412
- | Self :: MissingIndex { to_type, .. }
413
392
| Self :: MissingVariant { to_type, .. }
414
393
| Self :: NamedFieldError { to_type, .. }
415
394
| Self :: UnnamedFieldError { to_type, .. }
@@ -427,7 +406,6 @@ impl FromReflectError {
427
406
| Self :: InvalidLength { from_kind, .. }
428
407
| Self :: MissingNamedField { from_kind, .. }
429
408
| Self :: MissingUnnamedField { from_kind, .. }
430
- | Self :: MissingIndex { from_kind, .. }
431
409
| Self :: MissingVariant { from_kind, .. }
432
410
| Self :: NamedFieldError { from_kind, .. }
433
411
| Self :: UnnamedFieldError { from_kind, .. }
@@ -469,8 +447,8 @@ impl FromReflectError {
469
447
mod tests {
470
448
use crate as bevy_reflect;
471
449
use crate :: {
472
- DynamicEnum , DynamicList , DynamicMap , DynamicStruct , DynamicTuple , DynamicTupleStruct ,
473
- DynamicVariant , FromReflect , FromReflectError , Reflect , ReflectKind , TypeInfo ,
450
+ DynamicEnum , DynamicList , DynamicMap , DynamicStruct , DynamicTupleStruct , DynamicVariant ,
451
+ FromReflect , FromReflectError , Reflect , ReflectKind , TypeInfo ,
474
452
} ;
475
453
use bevy_utils:: HashMap ;
476
454
use std:: borrow:: Cow ;
@@ -568,27 +546,6 @@ mod tests {
568
546
) ;
569
547
}
570
548
571
- #[ test]
572
- fn check_missing_index ( ) {
573
- let mut dyn_tuple = DynamicTuple :: default ( ) ;
574
- dyn_tuple. insert ( 5 ) ;
575
-
576
- let result = <( i32 , i32 ) >:: from_reflect ( & dyn_tuple) ;
577
-
578
- assert ! (
579
- matches!(
580
- result,
581
- Err ( FromReflectError :: MissingIndex {
582
- from_type: TypeInfo :: Dynamic ( _) ,
583
- from_kind: ReflectKind :: Tuple ,
584
- to_type: TypeInfo :: Tuple ( _) ,
585
- index: 1 ,
586
- } )
587
- ) ,
588
- "Incorrect error handling of FromReflectError::MissingIndex"
589
- ) ;
590
- }
591
-
592
549
#[ test]
593
550
fn check_missing_variant ( ) {
594
551
#[ derive( Reflect , FromReflect ) ]
0 commit comments