File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ struct Foo {
2828#[derive(Reflect )]
2929struct Bar (String );
3030
31- #[derive(Reflect )]
31+ #[derive(Reflect , FromReflect )]
3232struct Baz {
3333 value : f32 ,
3434}
@@ -77,7 +77,7 @@ assert_eq!(value, 3.14);
7777``` rust ignore
7878for (i , value : & Reflect ) in foo . iter_fields (). enumerate () {
7979 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 >() {
8181 println! (" {} is a u32 with the value: {}" , field_name , * value );
8282 }
8383}
@@ -137,7 +137,7 @@ let reflect_value: Box<dyn Reflect> = Box::new(MyType {
137137// don't know the type at compile time?
138138
139139// 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 ();
141141type_registry . register :: <MyType >();
142142
143143// 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