use crate::{1array::array_debug, enums::enum_debug, list::list_debug, map::map_debug, set::set_debug,2structs::struct_debug, tuple::tuple_debug, tuple_struct::tuple_struct_debug, DynamicTypePath,3DynamicTyped, OpaqueInfo, ReflectCloneError, ReflectKind, ReflectKindMismatchError, ReflectMut,4ReflectOwned, ReflectRef, TypeInfo, TypePath, Typed,5};6use alloc::borrow::Cow;7use alloc::boxed::Box;8use alloc::string::ToString;9use core::{10any::{Any, TypeId},11cmp::Ordering,12fmt::Debug,13};1415use thiserror::Error;1617use crate::utility::NonGenericTypeInfoCell;1819/// A enumeration of all error outcomes that might happen when running [`try_apply`](PartialReflect::try_apply).20#[derive(Error, Debug)]21pub enum ApplyError {22#[error("attempted to apply `{from_kind}` to `{to_kind}`")]23/// Attempted to apply the wrong [kind](ReflectKind) to a type, e.g. a struct to an enum.24MismatchedKinds {25/// Kind of the value we attempted to apply.26from_kind: ReflectKind,27/// Kind of the type we attempted to apply the value to.28to_kind: ReflectKind,29},3031#[error("enum variant `{variant_name}` doesn't have a field named `{field_name}`")]32/// Enum variant that we tried to apply to was missing a field.33MissingEnumField {34/// Name of the enum variant.35variant_name: Box<str>,36/// Name of the missing field.37field_name: Box<str>,38},3940#[error("`{from_type}` is not `{to_type}`")]41/// Tried to apply incompatible types.42MismatchedTypes {43/// Type of the value we attempted to apply.44from_type: Box<str>,45/// Type we attempted to apply the value to.46to_type: Box<str>,47},4849#[error("attempted to apply type with {from_size} size to a type with {to_size} size")]50/// Attempted to apply an [array-like] type to another of different size, e.g. a [u8; 4] to [u8; 3].51///52/// [array-like]: crate::array::Array53DifferentSize {54/// Size of the value we attempted to apply, in elements.55from_size: usize,56/// Size of the type we attempted to apply the value to, in elements.57to_size: usize,58},5960#[error("variant with name `{variant_name}` does not exist on enum `{enum_name}`")]61/// The enum we tried to apply to didn't contain a variant with the give name.62UnknownVariant {63/// Name of the enum.64enum_name: Box<str>,65/// Name of the missing variant.66variant_name: Box<str>,67},68}6970impl From<ReflectKindMismatchError> for ApplyError {71fn from(value: ReflectKindMismatchError) -> Self {72Self::MismatchedKinds {73from_kind: value.received,74to_kind: value.expected,75}76}77}7879/// The foundational trait of [`bevy_reflect`], used for accessing and modifying data dynamically.80///81/// This is a supertrait of [`Reflect`],82/// meaning any type which implements `Reflect` implements `PartialReflect` by definition.83///84/// It's recommended to use [the derive macro for `Reflect`] rather than manually implementing this trait.85/// Doing so will automatically implement this trait as well as many other useful traits for reflection,86/// including one of the appropriate subtraits: [`Struct`], [`TupleStruct`] or [`Enum`].87///88/// See the [crate-level documentation] to see how this trait and its subtraits can be used.89///90/// [`bevy_reflect`]: crate91/// [the derive macro for `Reflect`]: bevy_reflect_derive::Reflect92/// [`Struct`]: crate::structs::Struct93/// [`TupleStruct`]: crate::tuple_struct::TupleStruct94/// [`Enum`]: crate::enums::Enum95/// [crate-level documentation]: crate96#[diagnostic::on_unimplemented(97message = "`{Self}` does not implement `PartialReflect` so cannot be introspected",98note = "consider annotating `{Self}` with `#[derive(Reflect)]`"99)]100pub trait PartialReflect: DynamicTypePath + Send + Sync101where102// NB: we don't use `Self: Any` since for downcasting, `Reflect` should be used.103Self: 'static,104{105/// Returns the [`TypeInfo`] of the type _represented_ by this value.106///107/// For most types, this will simply return their own `TypeInfo`.108/// However, for dynamic types, such as [`DynamicStruct`] or [`DynamicList`],109/// this will return the type they represent110/// (or `None` if they don't represent any particular type).111///112/// This method is great if you have an instance of a type or a `dyn Reflect`,113/// and want to access its [`TypeInfo`]. However, if this method is to be called114/// frequently, consider using [`TypeRegistry::get_type_info`] as it can be more115/// performant for such use cases.116///117/// [`DynamicStruct`]: crate::structs::DynamicStruct118/// [`DynamicList`]: crate::list::DynamicList119/// [`TypeRegistry::get_type_info`]: crate::TypeRegistry::get_type_info120fn get_represented_type_info(&self) -> Option<&'static TypeInfo>;121122/// Casts this type to a boxed, reflected value.123///124/// This is useful for coercing trait objects.125fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>;126127/// Casts this type to a reflected value.128///129/// This is useful for coercing trait objects.130fn as_partial_reflect(&self) -> &dyn PartialReflect;131132/// Casts this type to a mutable, reflected value.133///134/// This is useful for coercing trait objects.135fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect;136137/// Attempts to cast this type to a boxed, [fully-reflected] value.138///139/// [fully-reflected]: Reflect140fn try_into_reflect(self: Box<Self>) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>;141142/// Attempts to cast this type to a [fully-reflected] value.143///144/// [fully-reflected]: Reflect145fn try_as_reflect(&self) -> Option<&dyn Reflect>;146147/// Attempts to cast this type to a mutable, [fully-reflected] value.148///149/// [fully-reflected]: Reflect150fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>;151152/// Applies a reflected value to this value.153///154/// If `Self` implements a [reflection subtrait], then the semantics of this155/// method are as follows:156/// - If `Self` is a [`Struct`], then the value of each named field of `value` is157/// applied to the corresponding named field of `self`. Fields which are158/// not present in both structs are ignored.159/// - If `Self` is a [`TupleStruct`] or [`Tuple`], then the value of each160/// numbered field is applied to the corresponding numbered field of161/// `self.` Fields which are not present in both values are ignored.162/// - If `Self` is an [`Enum`], then the variant of `self` is `updated` to match163/// the variant of `value`. The corresponding fields of that variant are164/// applied from `value` onto `self`. Fields which are not present in both165/// values are ignored.166/// - If `Self` is a [`List`] or [`Array`], then each element of `value` is applied167/// to the corresponding element of `self`. Up to `self.len()` items are applied,168/// and excess elements in `value` are appended to `self`.169/// - If `Self` is a [`Map`], then for each key in `value`, the associated170/// value is applied to the value associated with the same key in `self`.171/// Keys which are not present in `self` are inserted, and keys from `self` which are not present in `value` are removed.172/// - If `Self` is a [`Set`], then each element of `value` is applied to the corresponding173/// element of `Self`. If an element of `value` does not exist in `Self` then it is174/// cloned and inserted. If an element from `self` is not present in `value` then it is removed.175/// - If `Self` is none of these, then `value` is downcast to `Self`, cloned, and176/// assigned to `self`.177///178/// Note that `Reflect` must be implemented manually for [`List`]s,179/// [`Map`]s, and [`Set`]s in order to achieve the correct semantics, as derived180/// implementations will have the semantics for [`Struct`], [`TupleStruct`], [`Enum`]181/// or none of the above depending on the kind of type. For lists, maps, and sets, use the182/// [`list_apply`], [`map_apply`], and [`set_apply`] helper functions when implementing this method.183///184/// [reflection subtrait]: crate#the-reflection-subtraits185/// [`Struct`]: crate::structs::Struct186/// [`TupleStruct`]: crate::tuple_struct::TupleStruct187/// [`Tuple`]: crate::tuple::Tuple188/// [`Enum`]: crate::enums::Enum189/// [`List`]: crate::list::List190/// [`Array`]: crate::array::Array191/// [`Map`]: crate::map::Map192/// [`Set`]: crate::set::Set193/// [`list_apply`]: crate::list::list_apply194/// [`map_apply`]: crate::map::map_apply195/// [`set_apply`]: crate::set::set_apply196///197/// # Panics198///199/// Derived implementations of this method will panic:200/// - If the type of `value` is not of the same kind as `Self` (e.g. if `Self` is201/// a `List`, while `value` is a `Struct`).202/// - If `Self` is any complex type and the corresponding fields or elements of203/// `self` and `value` are not of the same type.204/// - If `Self` is an opaque type and `value` cannot be downcast to `Self`205fn apply(&mut self, value: &dyn PartialReflect) {206PartialReflect::try_apply(self, value).unwrap();207}208209/// Tries to [`apply`](PartialReflect::apply) a reflected value to this value.210///211/// Functions the same as the [`apply`](PartialReflect::apply) function but returns an error instead of212/// panicking.213///214/// # Handling Errors215///216/// This function may leave `self` in a partially mutated state if a error was encountered on the way.217/// consider maintaining a cloned instance of this data you can switch to if a error is encountered.218fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError>;219220/// Returns a zero-sized enumeration of "kinds" of type.221///222/// See [`ReflectKind`].223fn reflect_kind(&self) -> ReflectKind {224self.reflect_ref().kind()225}226227/// Returns an immutable enumeration of "kinds" of type.228///229/// See [`ReflectRef`].230fn reflect_ref(&self) -> ReflectRef<'_>;231232/// Returns a mutable enumeration of "kinds" of type.233///234/// See [`ReflectMut`].235fn reflect_mut(&mut self) -> ReflectMut<'_>;236237/// Returns an owned enumeration of "kinds" of type.238///239/// See [`ReflectOwned`].240fn reflect_owned(self: Box<Self>) -> ReflectOwned;241242/// Converts this reflected value into its dynamic representation based on its [kind].243///244/// For example, a [`List`] type will internally invoke [`List::to_dynamic_list`], returning [`DynamicList`].245/// A [`Struct`] type will invoke [`Struct::to_dynamic_struct`], returning [`DynamicStruct`].246/// And so on.247///248/// If the [kind] is [opaque], then the value will attempt to be cloned directly via [`reflect_clone`],249/// since opaque types do not have any standard dynamic representation.250///251/// To attempt to clone the value directly such that it returns a concrete instance of this type,252/// use [`reflect_clone`].253///254/// # Panics255///256/// This method will panic if the [kind] is [opaque] and the call to [`reflect_clone`] fails.257///258/// # Example259///260/// ```261/// # use bevy_reflect::{PartialReflect};262/// let value = (1, true, 3.14);263/// let dynamic_value = value.to_dynamic();264/// assert!(dynamic_value.is_dynamic())265/// ```266///267/// [kind]: PartialReflect::reflect_kind268/// [`List`]: crate::list::List269/// [`List::to_dynamic_list`]: crate::list::List::to_dynamic_list270/// [`DynamicList`]: crate::list::DynamicList271/// [`Struct`]: crate::structs::Struct272/// [`Struct::to_dynamic_struct`]: crate::structs::Struct::to_dynamic_struct273/// [`DynamicStruct`]: crate::structs::DynamicStruct274/// [opaque]: crate::ReflectKind::Opaque275/// [`reflect_clone`]: PartialReflect::reflect_clone276fn to_dynamic(&self) -> Box<dyn PartialReflect> {277match self.reflect_ref() {278ReflectRef::Struct(dyn_struct) => Box::new(dyn_struct.to_dynamic_struct()),279ReflectRef::TupleStruct(dyn_tuple_struct) => {280Box::new(dyn_tuple_struct.to_dynamic_tuple_struct())281}282ReflectRef::Tuple(dyn_tuple) => Box::new(dyn_tuple.to_dynamic_tuple()),283ReflectRef::List(dyn_list) => Box::new(dyn_list.to_dynamic_list()),284ReflectRef::Array(dyn_array) => Box::new(dyn_array.to_dynamic_array()),285ReflectRef::Map(dyn_map) => Box::new(dyn_map.to_dynamic_map()),286ReflectRef::Set(dyn_set) => Box::new(dyn_set.to_dynamic_set()),287ReflectRef::Enum(dyn_enum) => Box::new(dyn_enum.to_dynamic_enum()),288#[cfg(feature = "functions")]289ReflectRef::Function(dyn_function) => Box::new(dyn_function.to_dynamic_function()),290ReflectRef::Opaque(value) => value.reflect_clone().unwrap().into_partial_reflect(),291}292}293294/// Attempts to clone `Self` using reflection.295///296/// Unlike [`to_dynamic`], which generally returns a dynamic representation of `Self`,297/// this method attempts create a clone of `Self` directly, if possible.298///299/// If the clone cannot be performed, an appropriate [`ReflectCloneError`] is returned.300///301/// # Example302///303/// ```304/// # use bevy_reflect::PartialReflect;305/// let value = (1, true, 3.14);306/// let cloned = value.reflect_clone().unwrap();307/// assert!(cloned.is::<(i32, bool, f64)>())308/// ```309///310/// [`to_dynamic`]: PartialReflect::to_dynamic311fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {312Err(ReflectCloneError::NotImplemented {313type_path: Cow::Owned(self.reflect_type_path().to_string()),314})315}316317/// For a type implementing [`PartialReflect`], combines `reflect_clone` and318/// `take` in a useful fashion, automatically constructing an appropriate319/// [`ReflectCloneError`] if the downcast fails.320///321/// This is an associated function, rather than a method, because methods322/// with generic types prevent dyn-compatibility.323fn reflect_clone_and_take<T: 'static>(&self) -> Result<T, ReflectCloneError>324where325Self: TypePath + Sized,326{327self.reflect_clone()?328.take()329.map_err(|_| ReflectCloneError::FailedDowncast {330expected: Cow::Borrowed(<Self as TypePath>::type_path()),331received: Cow::Owned(self.reflect_type_path().to_string()),332})333}334335/// Returns a hash of the value (which includes the type).336///337/// If the underlying type does not support hashing, returns `None`.338fn reflect_hash(&self) -> Option<u64> {339None340}341342/// Returns a "partial equality" comparison result.343///344/// If the underlying type does not support equality testing, returns `None`.345fn reflect_partial_eq(&self, _value: &dyn PartialReflect) -> Option<bool> {346None347}348349/// Returns a "partial comparison" result.350///351/// If the underlying type does not support it, returns `None`.352fn reflect_partial_cmp(&self, _value: &dyn PartialReflect) -> Option<Ordering> {353None354}355356/// Debug formatter for the value.357///358/// Any value that is not an implementor of other `Reflect` subtraits359/// (e.g. [`List`], [`Map`]), will default to the format: `"Reflect(type_path)"`,360/// where `type_path` is the [type path] of the underlying type.361///362/// [`List`]: crate::list::List363/// [`Map`]: crate::map::Map364/// [type path]: TypePath::type_path365fn debug(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {366match self.reflect_ref() {367ReflectRef::Struct(dyn_struct) => struct_debug(dyn_struct, f),368ReflectRef::TupleStruct(dyn_tuple_struct) => tuple_struct_debug(dyn_tuple_struct, f),369ReflectRef::Tuple(dyn_tuple) => tuple_debug(dyn_tuple, f),370ReflectRef::List(dyn_list) => list_debug(dyn_list, f),371ReflectRef::Array(dyn_array) => array_debug(dyn_array, f),372ReflectRef::Map(dyn_map) => map_debug(dyn_map, f),373ReflectRef::Set(dyn_set) => set_debug(dyn_set, f),374ReflectRef::Enum(dyn_enum) => enum_debug(dyn_enum, f),375#[cfg(feature = "functions")]376ReflectRef::Function(dyn_function) => dyn_function.fmt(f),377ReflectRef::Opaque(_) => write!(f, "Reflect({})", self.reflect_type_path()),378}379}380381/// Indicates whether or not this type is a _dynamic_ type.382///383/// Dynamic types include the ones built-in to this [crate],384/// such as [`DynamicStruct`], [`DynamicList`], and [`DynamicTuple`].385/// However, they may be custom types used as proxies for other types386/// or to facilitate scripting capabilities.387///388/// By default, this method will return `false`.389///390/// [`DynamicStruct`]: crate::structs::DynamicStruct391/// [`DynamicList`]: crate::list::DynamicList392/// [`DynamicTuple`]: crate::tuple::DynamicTuple393fn is_dynamic(&self) -> bool {394false395}396}397398/// A core trait of [`bevy_reflect`], used for downcasting to concrete types.399///400/// This is a subtrait of [`PartialReflect`],401/// meaning any type which implements `Reflect` implements `PartialReflect` by definition.402///403/// It's recommended to use [the derive macro] rather than manually implementing this trait.404/// Doing so will automatically implement this trait, [`PartialReflect`], and many other useful traits for reflection,405/// including one of the appropriate subtraits: [`Struct`], [`TupleStruct`] or [`Enum`].406///407/// If you need to use this trait as a generic bound along with other reflection traits,408/// for your convenience, consider using [`Reflectable`] instead.409///410/// See the [crate-level documentation] to see how this trait can be used.411///412/// [`bevy_reflect`]: crate413/// [the derive macro]: bevy_reflect_derive::Reflect414/// [`Struct`]: crate::structs::Struct415/// [`TupleStruct`]: crate::tuple_struct::TupleStruct416/// [`Enum`]: crate::enums::Enum417/// [`Reflectable`]: crate::Reflectable418/// [crate-level documentation]: crate419#[diagnostic::on_unimplemented(420message = "`{Self}` does not implement `Reflect` so cannot be fully reflected",421note = "consider annotating `{Self}` with `#[derive(Reflect)]`"422)]423pub trait Reflect: PartialReflect + DynamicTyped + Any {424/// Returns the value as a [`Box<dyn Any>`][core::any::Any].425///426/// For remote wrapper types, this will return the remote type instead.427fn into_any(self: Box<Self>) -> Box<dyn Any>;428429/// Returns the value as a [`&dyn Any`][core::any::Any].430///431/// For remote wrapper types, this will return the remote type instead.432fn as_any(&self) -> &dyn Any;433434/// Returns the value as a [`&mut dyn Any`][core::any::Any].435///436/// For remote wrapper types, this will return the remote type instead.437fn as_any_mut(&mut self) -> &mut dyn Any;438439/// Casts this type to a boxed, fully-reflected value.440fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>;441442/// Casts this type to a fully-reflected value.443fn as_reflect(&self) -> &dyn Reflect;444445/// Casts this type to a mutable, fully-reflected value.446fn as_reflect_mut(&mut self) -> &mut dyn Reflect;447448/// Performs a type-checked assignment of a reflected value to this value.449///450/// If `value` does not contain a value of type `T`, returns an `Err`451/// containing the trait object.452fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>;453}454455impl dyn PartialReflect {456/// Returns `true` if the underlying value represents a value of type `T`, or `false`457/// otherwise.458///459/// Read `is` for more information on underlying values and represented types.460#[inline]461pub fn represents<T: Reflect + TypePath>(&self) -> bool {462self.get_represented_type_info()463.is_some_and(|t| t.type_path() == T::type_path())464}465466/// Downcasts the value to type `T`, consuming the trait object.467///468/// If the underlying value does not implement [`Reflect`]469/// or is not of type `T`, returns `Err(self)`.470///471/// For remote types, `T` should be the type itself rather than the wrapper type.472pub fn try_downcast<T: Any>(473self: Box<dyn PartialReflect>,474) -> Result<Box<T>, Box<dyn PartialReflect>> {475self.try_into_reflect()?476.downcast()477.map_err(PartialReflect::into_partial_reflect)478}479480/// Downcasts the value to type `T`, unboxing and consuming the trait object.481///482/// If the underlying value does not implement [`Reflect`]483/// or is not of type `T`, returns `Err(self)`.484///485/// For remote types, `T` should be the type itself rather than the wrapper type.486pub fn try_take<T: Any>(self: Box<dyn PartialReflect>) -> Result<T, Box<dyn PartialReflect>> {487self.try_downcast().map(|value| *value)488}489490/// Downcasts the value to type `T` by reference.491///492/// If the underlying value does not implement [`Reflect`]493/// or is not of type `T`, returns [`None`].494///495/// For remote types, `T` should be the type itself rather than the wrapper type.496pub fn try_downcast_ref<T: Any>(&self) -> Option<&T> {497self.try_as_reflect()?.downcast_ref()498}499500/// Downcasts the value to type `T` by mutable reference.501///502/// If the underlying value does not implement [`Reflect`]503/// or is not of type `T`, returns [`None`].504///505/// For remote types, `T` should be the type itself rather than the wrapper type.506pub fn try_downcast_mut<T: Any>(&mut self) -> Option<&mut T> {507self.try_as_reflect_mut()?.downcast_mut()508}509}510511impl Debug for dyn PartialReflect {512fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {513self.debug(f)514}515}516517// The following implementation never actually shadows the concrete TypePath implementation.518// See the comment on `dyn Reflect`'s `TypePath` implementation.519impl TypePath for dyn PartialReflect {520fn type_path() -> &'static str {521"dyn bevy_reflect::PartialReflect"522}523524fn short_type_path() -> &'static str {525"dyn PartialReflect"526}527}528529#[deny(rustdoc::broken_intra_doc_links)]530impl dyn Reflect {531/// Downcasts the value to type `T`, consuming the trait object.532///533/// If the underlying value is not of type `T`, returns `Err(self)`.534///535/// For remote types, `T` should be the type itself rather than the wrapper type.536pub fn downcast<T: Any>(self: Box<dyn Reflect>) -> Result<Box<T>, Box<dyn Reflect>> {537if self.is::<T>() {538Ok(self.into_any().downcast().unwrap())539} else {540Err(self)541}542}543544/// Downcasts the value to type `T`, unboxing and consuming the trait object.545///546/// If the underlying value is not of type `T`, returns `Err(self)`.547///548/// For remote types, `T` should be the type itself rather than the wrapper type.549pub fn take<T: Any>(self: Box<dyn Reflect>) -> Result<T, Box<dyn Reflect>> {550self.downcast::<T>().map(|value| *value)551}552553/// Returns `true` if the underlying value is of type `T`, or `false`554/// otherwise.555///556/// The underlying value is the concrete type that is stored in this `dyn` object;557/// it can be downcast to. In the case that this underlying value "represents"558/// a different type, like the Dynamic\*\*\* types do, you can call `represents`559/// to determine what type they represent. Represented types cannot be downcast560/// to, but you can use [`FromReflect`] to create a value of the represented type from them.561///562/// For remote types, `T` should be the type itself rather than the wrapper type.563///564/// [`FromReflect`]: crate::FromReflect565#[inline]566pub fn is<T: Any>(&self) -> bool {567self.as_any().type_id() == TypeId::of::<T>()568}569570/// Downcasts the value to type `T` by reference.571///572/// If the underlying value is not of type `T`, returns `None`.573///574/// For remote types, `T` should be the type itself rather than the wrapper type.575#[inline]576pub fn downcast_ref<T: Any>(&self) -> Option<&T> {577self.as_any().downcast_ref::<T>()578}579580/// Downcasts the value to type `T` by mutable reference.581///582/// If the underlying value is not of type `T`, returns `None`.583///584/// For remote types, `T` should be the type itself rather than the wrapper type.585#[inline]586pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {587self.as_any_mut().downcast_mut::<T>()588}589}590591impl Debug for dyn Reflect {592fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {593self.debug(f)594}595}596597impl Typed for dyn Reflect {598fn type_info() -> &'static TypeInfo {599static CELL: NonGenericTypeInfoCell = NonGenericTypeInfoCell::new();600CELL.get_or_set(|| TypeInfo::Opaque(OpaqueInfo::new::<Self>()))601}602}603604// The following implementation never actually shadows the concrete `TypePath` implementation.605// See this playground (https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=589064053f27bc100d90da89c6a860aa).606impl TypePath for dyn Reflect {607fn type_path() -> &'static str {608"dyn bevy_reflect::Reflect"609}610611fn short_type_path() -> &'static str {612"dyn Reflect"613}614}615616macro_rules! impl_full_reflect {617($(<$($id:ident),* $(,)?>)? for $ty:ty $(where $($tt:tt)*)?) => {618impl $(<$($id),*>)? $crate::Reflect for $ty $(where $($tt)*)? {619fn into_any(self: bevy_platform::prelude::Box<Self>) -> bevy_platform::prelude::Box<dyn ::core::any::Any> {620self621}622623fn as_any(&self) -> &dyn ::core::any::Any {624self625}626627fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any {628self629}630631fn into_reflect(self: bevy_platform::prelude::Box<Self>) -> bevy_platform::prelude::Box<dyn $crate::Reflect> {632self633}634635fn as_reflect(&self) -> &dyn $crate::Reflect {636self637}638639fn as_reflect_mut(&mut self) -> &mut dyn $crate::Reflect {640self641}642643fn set(644&mut self,645value: bevy_platform::prelude::Box<dyn $crate::Reflect>,646) -> Result<(), bevy_platform::prelude::Box<dyn $crate::Reflect>> {647*self = <dyn $crate::Reflect>::take(value)?;648Ok(())649}650}651};652}653654pub(crate) use impl_full_reflect;655656657