mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
ecs: publicly expose Added/Changed and inline some things
This commit is contained in:
parent
a4e291d9c8
commit
141044aae7
3 changed files with 8 additions and 2 deletions
|
@ -80,7 +80,9 @@ pub use borrow::{EntityRef, Ref, RefMut};
|
|||
pub use bundle::{Bundle, DynamicBundle, MissingComponent};
|
||||
pub use entities::{Entity, Location, NoSuchEntity};
|
||||
pub use entity_builder::{BuiltEntity, EntityBuilder};
|
||||
pub use query::{Access, BatchedIter, Query, QueryBorrow, QueryIter, With, Without, Mut, Mutated};
|
||||
pub use query::{
|
||||
Access, Added, BatchedIter, Changed, Mut, Mutated, Query, QueryBorrow, QueryIter, With, Without,
|
||||
};
|
||||
pub use query_one::QueryOne;
|
||||
pub use world::{ArchetypesGeneration, Component, ComponentError, Iter, SpawnBatchIter, World};
|
||||
|
||||
|
|
|
@ -229,6 +229,7 @@ pub struct Mutated<'a, T> {
|
|||
|
||||
impl<'a, T: Component> Deref for Mutated<'a, T> {
|
||||
type Target = T;
|
||||
#[inline]
|
||||
fn deref(&self) -> &T {
|
||||
self.value
|
||||
}
|
||||
|
@ -290,6 +291,7 @@ pub struct Added<'a, T> {
|
|||
|
||||
impl<'a, T: Component> Deref for Added<'a, T> {
|
||||
type Target = T;
|
||||
#[inline]
|
||||
fn deref(&self) -> &T {
|
||||
self.value
|
||||
}
|
||||
|
@ -352,6 +354,7 @@ pub struct Changed<'a, T> {
|
|||
|
||||
impl<'a, T: Component> Deref for Changed<'a, T> {
|
||||
type Target = T;
|
||||
#[inline]
|
||||
fn deref(&self) -> &T {
|
||||
self.value
|
||||
}
|
||||
|
@ -378,6 +381,7 @@ impl<'a, T: Component> Fetch<'a> for FetchChanged<T> {
|
|||
fn borrow(archetype: &Archetype) {
|
||||
archetype.borrow::<T>();
|
||||
}
|
||||
|
||||
unsafe fn get(archetype: &'a Archetype, offset: usize) -> Option<Self> {
|
||||
archetype
|
||||
.get_with_added_and_mutated::<T>()
|
||||
|
|
|
@ -16,6 +16,6 @@ pub mod prelude {
|
|||
Commands, IntoForEachSystem, IntoQuerySystem, IntoThreadLocalSystem, Query, System,
|
||||
},
|
||||
world::WorldBuilderSource,
|
||||
Bundle, Mutated, Component, Entity, Ref, RefMut, With, Without, World,
|
||||
Added, Bundle, Changed, Component, Entity, Mutated, Ref, RefMut, With, Without, World,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue