@@ -2,7 +2,7 @@ use bevy::{
22 prelude:: * ,
33 reflect:: {
44 serde:: { ReflectDeserializer , ReflectSerializer } ,
5- DynamicStruct , FromReflect , TypeRegistry ,
5+ DynamicStruct , TypeRegistry ,
66 } ,
77} ;
88use serde:: de:: DeserializeSeed ;
@@ -21,8 +21,8 @@ fn main() {
2121
2222/// Deriving `Reflect` implements the relevant reflection traits. In this case, it implements the
2323/// `Reflect` trait and the `Struct` trait `derive(Reflect)` assumes that all fields also implement
24- /// Reflect, except the ignored fields which should implement `Default` .
25- #[ derive( Reflect , FromReflect ) ]
24+ /// Reflect.
25+ #[ derive( Reflect ) ]
2626pub struct Foo {
2727 a : usize ,
2828 nested : Bar ,
@@ -32,12 +32,11 @@ pub struct Foo {
3232
3333/// This `Bar` type is used in the `nested` field on the `Test` type. We must derive `Reflect` here
3434/// too (or ignore it)
35- #[ derive( Reflect , FromReflect ) ]
35+ #[ derive( Reflect ) ]
3636pub struct Bar {
3737 b : usize ,
3838}
3939
40- #[ derive( Default ) ]
4140pub struct NonReflectedValue {
4241 _a : usize ,
4342}
@@ -88,9 +87,6 @@ fn setup(type_registry: Res<TypeRegistry>) {
8887 // DynamicStruct type. "Value types" will be deserialized as themselves.
8988 let _deserialized_struct = reflect_value. downcast_ref :: < DynamicStruct > ( ) ;
9089
91- // A dynamic type can be converted back into a concrete one using the FromReflect trait
92- let _deserialized_concrete_value: Foo = Foo :: from_reflect ( & * reflect_value) . unwrap ( ) ;
93-
9490 // Reflect has its own `partial_eq` implementation, named `reflect_partial_eq`. This behaves
9591 // like normal `partial_eq`, but it treats "dynamic" and "non-dynamic" types the same. The
9692 // `Foo` struct and deserialized `DynamicStruct` are considered equal for this reason:
0 commit comments