Add reflect for type id (#12495)
# Objective Add reflect for `std::any::TypeId`. I couldn't add ReflectSerialize/ReflectDeserialize for it, it was giving me an error. I don't really understand why, since it works for `std::path::PathBuf`. Co-authored-by: Charles Bournhonesque <cbournhonesque@snapchat.com>
This commit is contained in:
parent
16fb995697
commit
24b319f6ec
@ -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 > ()
|
||||
@ -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!";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user