Fix examples in bevy_reflect/README.md (#963)

This commit is contained in:
Toothbrush 2020-12-01 02:12:09 +00:00 committed by GitHub
parent 4c1bc02723
commit bc2f43c1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ This crate enables you to dynamically interact with Rust types:
#[derive(Reflect)] #[derive(Reflect)]
struct Foo { struct Foo {
a: u32, a: u32,
b: Bar b: Bar,
c: Vec<i32>, c: Vec<i32>,
d: Vec<Bar>, d: Vec<Bar>,
} }
@ -31,14 +31,14 @@ struct Bar(String);
#[derive(Reflect)] #[derive(Reflect)]
struct Baz { struct Baz {
value: f32, value: f32,
}; }
// We will use this value to illustrate `bevy_reflect` features // We will use this value to illustrate `bevy_reflect` features
let mut foo = Foo { let mut foo = Foo {
a: 1, a: 1,
b: Bar("hello".to_string()), b: Bar("hello".to_string()),
c: vec![1, 2] c: vec![1, 2],
d: vec![Baz { value: 3.14 }] d: vec![Baz { value: 3.14 }],
}; };
``` ```
@ -163,4 +163,4 @@ The whole point of Rust is static safety! Why build something that makes it easy
* Some problems are inherently dynamic (scripting, some types of serialization / deserialization) * Some problems are inherently dynamic (scripting, some types of serialization / deserialization)
* Sometimes the dynamic way is easier * Sometimes the dynamic way is easier
* Sometimes the dynamic way puts less burden on your users to derive a bunch of traits (this was a big motivator for the Bevy project) * Sometimes the dynamic way puts less burden on your users to derive a bunch of traits (this was a big motivator for the Bevy project)