File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ struct Foo {
28
28
#[derive(Reflect )]
29
29
struct Bar (String );
30
30
31
- #[derive(Reflect )]
31
+ #[derive(Reflect , FromReflect )]
32
32
struct Baz {
33
33
value : f32 ,
34
34
}
@@ -77,7 +77,7 @@ assert_eq!(value, 3.14);
77
77
``` rust ignore
78
78
for (i , value : & Reflect ) in foo . iter_fields (). enumerate () {
79
79
let field_name = foo . name_at (i ). unwrap ();
80
- if let Ok (value ) = value . downcast_ref :: <u32 >() {
80
+ if let Some (value ) = value . downcast_ref :: <u32 >() {
81
81
println! (" {} is a u32 with the value: {}" , field_name , * value );
82
82
}
83
83
}
@@ -137,7 +137,7 @@ let reflect_value: Box<dyn Reflect> = Box::new(MyType {
137
137
// don't know the type at compile time?
138
138
139
139
// Normally in rust we would be out of luck at this point. Lets use our new reflection powers to do something cool!
140
- let mut type_registry = TypeRegistry :: default ()
140
+ let mut type_registry = TypeRegistry :: default ();
141
141
type_registry . register :: <MyType >();
142
142
143
143
// The #[reflect] attribute we put on our DoThing trait generated a new `ReflectDoThing` struct, which implements TypeData.
You can’t perform that action at this time.
0 commit comments