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>`
This commit is contained in:
		
							parent
							
								
									3d194a2160
								
							
						
					
					
						commit
						886837d731
					
				@ -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<T: smallvec::Array + Send + Sync + 'static> Array for SmallVec<T>
 | 
			
		||||
@ -139,3 +140,14 @@ where
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<T: smallvec::Array + Send + Sync + 'static> GetTypeRegistration for SmallVec<T>
 | 
			
		||||
where
 | 
			
		||||
    T::Item: FromReflect + Clone,
 | 
			
		||||
{
 | 
			
		||||
    fn get_type_registration() -> TypeRegistration {
 | 
			
		||||
        let mut registration = TypeRegistration::of::<SmallVec<T>>();
 | 
			
		||||
        registration.insert::<ReflectFromPtr>(FromType::<SmallVec<T>>::from_type());
 | 
			
		||||
        registration
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user