Skip to content

Commit

Permalink
fix bevy_reflect README (bevyengine#5477)
Browse files Browse the repository at this point in the history
# Objective

- Code in `bevy_reflect` README doesn't compile

## Solution

- Fix it
  • Loading branch information
mockersf authored and inodentry committed Aug 8, 2022
1 parent c5b3be7 commit ae593fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/bevy_reflect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Foo {
#[derive(Reflect)]
struct Bar(String);

#[derive(Reflect)]
#[derive(Reflect, FromReflect)]
struct Baz {
value: f32,
}
Expand Down Expand Up @@ -77,7 +77,7 @@ assert_eq!(value, 3.14);
```rust ignore
for (i, value: &Reflect) in foo.iter_fields().enumerate() {
let field_name = foo.name_at(i).unwrap();
if let Ok(value) = value.downcast_ref::<u32>() {
if let Some(value) = value.downcast_ref::<u32>() {
println!("{} is a u32 with the value: {}", field_name, *value);
}
}
Expand Down Expand Up @@ -137,7 +137,7 @@ let reflect_value: Box<dyn Reflect> = Box::new(MyType {
// don't know the type at compile time?

// Normally in rust we would be out of luck at this point. Lets use our new reflection powers to do something cool!
let mut type_registry = TypeRegistry::default()
let mut type_registry = TypeRegistry::default();
type_registry.register::<MyType>();

// The #[reflect] attribute we put on our DoThing trait generated a new `ReflectDoThing` struct, which implements TypeData.
Expand Down

0 comments on commit ae593fb

Please sign in to comment.