Skip to content

Commit

Permalink
Use FromReflect when deserializing
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGVSV committed Sep 22, 2022
1 parent 0ecc394 commit c907c92
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 107 deletions.
5 changes: 3 additions & 2 deletions crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ mod tests {
struct Foo {
a: u32,
#[reflect(ignore)]
#[reflect(default)]
_b: u32,
c: Vec<isize>,
d: HashMap<usize, i8>,
Expand Down Expand Up @@ -533,9 +534,9 @@ mod tests {
let mut deserializer = Deserializer::from_str(&serialized).unwrap();
let reflect_deserializer = UntypedReflectDeserializer::new(&registry);
let value = reflect_deserializer.deserialize(&mut deserializer).unwrap();
let dynamic_struct = value.take::<DynamicStruct>().unwrap();
let output = value.take::<Foo>().unwrap();

assert!(foo.reflect_partial_eq(&dynamic_struct).unwrap());
assert!(foo.reflect_partial_eq(&output).unwrap());
}

#[test]
Expand Down
Loading

0 comments on commit c907c92

Please sign in to comment.