2023-06-18 23:43:10 +00:00
|
|
|
//! Types that enable reflection support.
|
|
|
|
|
2023-06-21 17:25:01 +00:00
|
|
|
use std::ops::{Deref, DerefMut};
|
|
|
|
|
|
|
|
use crate as bevy_ecs;
|
|
|
|
use crate::{entity::Entity, system::Resource};
|
2023-06-18 23:43:10 +00:00
|
|
|
use bevy_reflect::{
|
|
|
|
impl_from_reflect_value, impl_reflect_value, ReflectDeserialize, ReflectSerialize,
|
2023-06-21 17:25:01 +00:00
|
|
|
TypeRegistryArc,
|
2023-06-18 23:43:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
mod component;
|
|
|
|
mod map_entities;
|
|
|
|
mod resource;
|
|
|
|
|
|
|
|
pub use component::{ReflectComponent, ReflectComponentFns};
|
|
|
|
pub use map_entities::ReflectMapEntities;
|
|
|
|
pub use resource::{ReflectResource, ReflectResourceFns};
|
|
|
|
|
2023-06-21 17:25:01 +00:00
|
|
|
/// A [`Resource`] storing [`TypeRegistry`](bevy_reflect::TypeRegistry) for
|
|
|
|
/// type registrations relevant to a whole app.
|
|
|
|
#[derive(Resource, Clone, Default)]
|
|
|
|
pub struct AppTypeRegistry(pub TypeRegistryArc);
|
|
|
|
|
|
|
|
impl Deref for AppTypeRegistry {
|
|
|
|
type Target = TypeRegistryArc;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
&self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DerefMut for AppTypeRegistry {
|
|
|
|
#[inline]
|
|
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
|
|
&mut self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-18 23:43:10 +00:00
|
|
|
impl_reflect_value!((in bevy_ecs) Entity(Hash, PartialEq, Serialize, Deserialize));
|
|
|
|
impl_from_reflect_value!(Entity);
|