From 886837d7313afeff8aef6985e8c70bd6ecc7ae55 Mon Sep 17 00:00:00 2001 From: Gino Valente Date: Wed, 24 Aug 2022 20:25:52 +0000 Subject: [PATCH] bevy_reflect: `GetTypeRegistration` for `SmallVec` (#5782) # Objective `SmallVec` was missing a `GetTypeRegistration` impl. ## Solution Added a `GetTypeRegistration` impl. --- ## Changelog * Added a `GetTypeRegistration` impl for `SmallVec` --- crates/bevy_reflect/src/impls/smallvec.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/bevy_reflect/src/impls/smallvec.rs b/crates/bevy_reflect/src/impls/smallvec.rs index 61d507986b15a..161e0312049b2 100644 --- a/crates/bevy_reflect/src/impls/smallvec.rs +++ b/crates/bevy_reflect/src/impls/smallvec.rs @@ -3,7 +3,8 @@ use std::any::Any; use crate::utility::GenericTypeInfoCell; use crate::{ - Array, ArrayIter, FromReflect, List, ListInfo, Reflect, ReflectMut, ReflectRef, TypeInfo, Typed, + Array, ArrayIter, FromReflect, FromType, GetTypeRegistration, List, ListInfo, Reflect, + ReflectFromPtr, ReflectMut, ReflectRef, TypeInfo, TypeRegistration, Typed, }; impl Array for SmallVec @@ -139,3 +140,14 @@ where } } } + +impl GetTypeRegistration for SmallVec +where + T::Item: FromReflect + Clone, +{ + fn get_type_registration() -> TypeRegistration { + let mut registration = TypeRegistration::of::>(); + registration.insert::(FromType::>::from_type()); + registration + } +}