Skip to content

Commit

Permalink
add reflect for type id
Browse files Browse the repository at this point in the history
  • Loading branch information
cbournhonesque-sc committed Mar 15, 2024
1 parent 16fb995 commit 3a37f8e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/bevy_reflect/src/impls/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ impl_reflect_value!(::std::path::PathBuf(
Deserialize,
Default
));
impl_reflect_value!(::std::any::TypeId(Debug, Hash, PartialEq,));
impl_reflect_value!(
::core::result::Result < T: Clone + Reflect + TypePath,
E: Clone + Reflect + TypePath > ()
Expand Down Expand Up @@ -2104,6 +2105,13 @@ mod tests {
assert_eq!(path, output);
}

#[test]
fn type_id_should_from_reflect() {
let type_id = std::any::TypeId::of::<usize>();
let output = <std::any::TypeId as FromReflect>::from_reflect(&type_id).unwrap();
assert_eq!(type_id, output);
}

#[test]
fn static_str_should_from_reflect() {
let expected = "Hello, World!";
Expand Down

0 comments on commit 3a37f8e

Please sign in to comment.