//! Module containing the [`ReflectDefault`] type.12use crate::{FromType, Reflect};3use alloc::boxed::Box;45/// A struct used to provide the default value of a type.6///7/// A [`ReflectDefault`] for type `T` can be obtained via [`FromType::from_type`].8#[derive(Clone)]9pub struct ReflectDefault {10default: fn() -> Box<dyn Reflect>,11}1213impl ReflectDefault {14/// Returns the default value for a type.15pub fn default(&self) -> Box<dyn Reflect> {16(self.default)()17}18}1920impl<T: Reflect + Default> FromType<T> for ReflectDefault {21fn from_type() -> Self {22ReflectDefault {23default: || Box::<T>::default(),24}25}26}272829