Skip to content

Commit 886837d

Browse files
committed
bevy_reflect: GetTypeRegistration for SmallVec<T> (#5782)
# Objective `SmallVec<T>` was missing a `GetTypeRegistration` impl. ## Solution Added a `GetTypeRegistration` impl. --- ## Changelog * Added a `GetTypeRegistration` impl for `SmallVec<T>`
1 parent 3d194a2 commit 886837d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/bevy_reflect/src/impls/smallvec.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::any::Any;
33

44
use crate::utility::GenericTypeInfoCell;
55
use crate::{
6-
Array, ArrayIter, FromReflect, List, ListInfo, Reflect, ReflectMut, ReflectRef, TypeInfo, Typed,
6+
Array, ArrayIter, FromReflect, FromType, GetTypeRegistration, List, ListInfo, Reflect,
7+
ReflectFromPtr, ReflectMut, ReflectRef, TypeInfo, TypeRegistration, Typed,
78
};
89

910
impl<T: smallvec::Array + Send + Sync + 'static> Array for SmallVec<T>
@@ -139,3 +140,14 @@ where
139140
}
140141
}
141142
}
143+
144+
impl<T: smallvec::Array + Send + Sync + 'static> GetTypeRegistration for SmallVec<T>
145+
where
146+
T::Item: FromReflect + Clone,
147+
{
148+
fn get_type_registration() -> TypeRegistration {
149+
let mut registration = TypeRegistration::of::<SmallVec<T>>();
150+
registration.insert::<ReflectFromPtr>(FromType::<SmallVec<T>>::from_type());
151+
registration
152+
}
153+
}

0 commit comments

Comments
 (0)