Harden proc macro path resolution and add integration tests. (#17330)
This pr uses the `extern crate self as` trick to make proc macros behave the same way inside and outside bevy. # Objective - Removes noise introduced by `crate as` in the whole bevy repo. - Fixes #17004. - Hardens proc macro path resolution. ## TODO - [x] `BevyManifest` needs cleanup. - [x] Cleanup remaining `crate as`. - [x] Add proper integration tests to the ci. ## Notes - `cargo-manifest-proc-macros` is written by me and based/inspired by the old `BevyManifest` implementation and [`bkchr/proc-macro-crate`](https://github.com/bkchr/proc-macro-crate). - What do you think about the new integration test machinery I added to the `ci`? More and better integration tests can be added at a later stage. The goal of these integration tests is to simulate an actual separate crate that uses bevy. Ideally they would lightly touch all bevy crates. ## Testing - Needs RA test - Needs testing from other users - Others need to run at least `cargo run -p ci integration-test` and verify that they work. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
669d139c13
commit
1b7db895b7
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ crates/**/target
|
|||||||
benches/**/target
|
benches/**/target
|
||||||
tools/**/target
|
tools/**/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
rustc-ice-*.txt
|
||||||
|
|
||||||
# DX12 wgpu backend
|
# DX12 wgpu backend
|
||||||
dxcompiler.dll
|
dxcompiler.dll
|
||||||
|
11
Cargo.toml
11
Cargo.toml
@ -29,6 +29,10 @@ members = [
|
|||||||
# Bevy's error codes. This is a crate so we can automatically check all of the code blocks.
|
# Bevy's error codes. This is a crate so we can automatically check all of the code blocks.
|
||||||
"errors",
|
"errors",
|
||||||
]
|
]
|
||||||
|
exclude = [
|
||||||
|
# Integration tests are not part of the workspace
|
||||||
|
"tests-integration",
|
||||||
|
]
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
doc_markdown = "warn"
|
doc_markdown = "warn"
|
||||||
@ -494,6 +498,13 @@ serde = { version = "1", features = ["derive"] }
|
|||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
bytemuck = "1.7"
|
bytemuck = "1.7"
|
||||||
bevy_render = { path = "crates/bevy_render", version = "0.16.0-dev", default-features = false }
|
bevy_render = { path = "crates/bevy_render", version = "0.16.0-dev", default-features = false }
|
||||||
|
# The following explicit dependencies are needed for proc macros to work inside of examples as they are part of the bevy crate itself.
|
||||||
|
bevy_ecs = { path = "crates/bevy_ecs", version = "0.16.0-dev", default-features = false }
|
||||||
|
bevy_state = { path = "crates/bevy_state", version = "0.16.0-dev", default-features = false }
|
||||||
|
bevy_asset = { path = "crates/bevy_asset", version = "0.16.0-dev", default-features = false }
|
||||||
|
bevy_reflect = { path = "crates/bevy_reflect", version = "0.16.0-dev", default-features = false }
|
||||||
|
bevy_image = { path = "crates/bevy_image", version = "0.16.0-dev", default-features = false }
|
||||||
|
bevy_gizmos = { path = "crates/bevy_gizmos", version = "0.16.0-dev", default-features = false }
|
||||||
# Needed to poll Task examples
|
# Needed to poll Task examples
|
||||||
futures-lite = "2.0.1"
|
futures-lite = "2.0.1"
|
||||||
async-std = "1.13"
|
async-std = "1.13"
|
||||||
|
@ -267,7 +267,7 @@ fn none_changed_detection(criterion: &mut Criterion) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn insert_if_bit_enabled<const B: u16>(entity: &mut EntityWorldMut, i: u16) {
|
fn insert_if_bit_enabled<const B: u16>(entity: &mut EntityWorldMut, i: u16) {
|
||||||
if i & 1 << B != 0 {
|
if i & (1 << B) != 0 {
|
||||||
entity.insert(Data::<B>(1.0));
|
entity.insert(Data::<B>(1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ fn setup(system_count: usize) -> (World, Schedule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn insert_if_bit_enabled<const B: u16>(entity: &mut EntityWorldMut, i: u16) {
|
fn insert_if_bit_enabled<const B: u16>(entity: &mut EntityWorldMut, i: u16) {
|
||||||
if i & 1 << B != 0 {
|
if i & (1 << B) != 0 {
|
||||||
entity.insert(A::<B>(1.0));
|
entity.insert(A::<B>(1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,49 +105,49 @@ fn add_archetypes(world: &mut World, count: u16) {
|
|||||||
e.insert(A::<10>(1.0));
|
e.insert(A::<10>(1.0));
|
||||||
e.insert(A::<11>(1.0));
|
e.insert(A::<11>(1.0));
|
||||||
e.insert(A::<12>(1.0));
|
e.insert(A::<12>(1.0));
|
||||||
if i & 1 << 1 != 0 {
|
if i & (1 << 1) != 0 {
|
||||||
e.insert(A::<13>(1.0));
|
e.insert(A::<13>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 2 != 0 {
|
if i & (1 << 2) != 0 {
|
||||||
e.insert(A::<14>(1.0));
|
e.insert(A::<14>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 3 != 0 {
|
if i & (1 << 3) != 0 {
|
||||||
e.insert(A::<15>(1.0));
|
e.insert(A::<15>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 4 != 0 {
|
if i & (1 << 4) != 0 {
|
||||||
e.insert(A::<16>(1.0));
|
e.insert(A::<16>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 5 != 0 {
|
if i & (1 << 5) != 0 {
|
||||||
e.insert(A::<18>(1.0));
|
e.insert(A::<18>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 6 != 0 {
|
if i & (1 << 6) != 0 {
|
||||||
e.insert(A::<19>(1.0));
|
e.insert(A::<19>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 7 != 0 {
|
if i & (1 << 7) != 0 {
|
||||||
e.insert(A::<20>(1.0));
|
e.insert(A::<20>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 8 != 0 {
|
if i & (1 << 8) != 0 {
|
||||||
e.insert(A::<21>(1.0));
|
e.insert(A::<21>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 9 != 0 {
|
if i & (1 << 9) != 0 {
|
||||||
e.insert(A::<22>(1.0));
|
e.insert(A::<22>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 10 != 0 {
|
if i & (1 << 10) != 0 {
|
||||||
e.insert(A::<23>(1.0));
|
e.insert(A::<23>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 11 != 0 {
|
if i & (1 << 11) != 0 {
|
||||||
e.insert(A::<24>(1.0));
|
e.insert(A::<24>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 12 != 0 {
|
if i & (1 << 12) != 0 {
|
||||||
e.insert(A::<25>(1.0));
|
e.insert(A::<25>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 13 != 0 {
|
if i & (1 << 13) != 0 {
|
||||||
e.insert(A::<26>(1.0));
|
e.insert(A::<26>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 14 != 0 {
|
if i & (1 << 14) != 0 {
|
||||||
e.insert(A::<27>(1.0));
|
e.insert(A::<27>(1.0));
|
||||||
}
|
}
|
||||||
if i & 1 << 15 != 0 {
|
if i & (1 << 15) != 0 {
|
||||||
e.insert(A::<28>(1.0));
|
e.insert(A::<28>(1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ struct Data<const X: u16>(f32);
|
|||||||
pub struct Benchmark<'w>(World, QueryState<(&'w Velocity, &'w mut Position)>);
|
pub struct Benchmark<'w>(World, QueryState<(&'w Velocity, &'w mut Position)>);
|
||||||
|
|
||||||
fn insert_if_bit_enabled<const B: u16>(entity: &mut EntityWorldMut, i: u16) {
|
fn insert_if_bit_enabled<const B: u16>(entity: &mut EntityWorldMut, i: u16) {
|
||||||
if i & 1 << B != 0 {
|
if i & (1 << B) != 0 {
|
||||||
entity.insert(Data::<B>(1.0));
|
entity.insert(Data::<B>(1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1532,7 +1532,6 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_derive_app_label() {
|
fn test_derive_app_label() {
|
||||||
use super::AppLabel;
|
use super::AppLabel;
|
||||||
use crate::{self as bevy_app};
|
|
||||||
|
|
||||||
#[derive(AppLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(AppLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
struct UnitLabel;
|
struct UnitLabel;
|
||||||
@ -1664,7 +1663,6 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_extract_sees_changes() {
|
fn test_extract_sees_changes() {
|
||||||
use super::AppLabel;
|
use super::AppLabel;
|
||||||
use crate::{self as bevy_app};
|
|
||||||
|
|
||||||
#[derive(AppLabel, Clone, Copy, Hash, PartialEq, Eq, Debug)]
|
#[derive(AppLabel, Clone, Copy, Hash, PartialEq, Eq, Debug)]
|
||||||
struct MySubApp;
|
struct MySubApp;
|
||||||
|
@ -20,6 +20,9 @@ extern crate std;
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
// Required to make proc macros work in bevy itself.
|
||||||
|
extern crate self as bevy_app;
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod main_schedule;
|
mod main_schedule;
|
||||||
mod panic_handler;
|
mod panic_handler;
|
||||||
|
@ -282,7 +282,7 @@ unsafe impl<A: AsAssetId> QueryFilter for AssetChanged<A> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{self as bevy_asset, AssetEvents, AssetPlugin, Handle};
|
use crate::{AssetEvents, AssetPlugin, Handle};
|
||||||
use alloc::{vec, vec::Vec};
|
use alloc::{vec, vec::Vec};
|
||||||
use core::num::NonZero;
|
use core::num::NonZero;
|
||||||
use std::println;
|
use std::println;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
use crate::asset_changed::AssetChanges;
|
use crate::asset_changed::AssetChanges;
|
||||||
use crate::{
|
use crate::{Asset, AssetEvent, AssetHandleProvider, AssetId, AssetServer, Handle, UntypedHandle};
|
||||||
self as bevy_asset, Asset, AssetEvent, AssetHandleProvider, AssetId, AssetServer, Handle,
|
|
||||||
UntypedHandle,
|
|
||||||
};
|
|
||||||
use alloc::{sync::Arc, vec::Vec};
|
use alloc::{sync::Arc, vec::Vec};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
prelude::EventWriter,
|
prelude::EventWriter,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
use crate as bevy_asset;
|
|
||||||
use crate::{Asset, UntypedHandle};
|
use crate::{Asset, UntypedHandle};
|
||||||
use bevy_reflect::TypePath;
|
use bevy_reflect::TypePath;
|
||||||
|
|
||||||
|
@ -149,6 +149,9 @@
|
|||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
extern crate std;
|
extern crate std;
|
||||||
|
|
||||||
|
// Required to make proc macros work in bevy itself.
|
||||||
|
extern crate self as bevy_asset;
|
||||||
|
|
||||||
pub mod io;
|
pub mod io;
|
||||||
pub mod meta;
|
pub mod meta;
|
||||||
pub mod processor;
|
pub mod processor;
|
||||||
@ -627,7 +630,6 @@ pub struct AssetEvents;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_asset,
|
|
||||||
folder::LoadedFolder,
|
folder::LoadedFolder,
|
||||||
handle::Handle,
|
handle::Handle,
|
||||||
io::{
|
io::{
|
||||||
|
@ -5,8 +5,8 @@ use alloc::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_asset, loader::AssetLoader, processor::Process, Asset, AssetPath,
|
loader::AssetLoader, processor::Process, Asset, AssetPath, DeserializeMetaError,
|
||||||
DeserializeMetaError, VisitAssetDependencies,
|
VisitAssetDependencies,
|
||||||
};
|
};
|
||||||
use downcast_rs::{impl_downcast, Downcast};
|
use downcast_rs::{impl_downcast, Downcast};
|
||||||
use ron::ser::PrettyConfig;
|
use ron::ser::PrettyConfig;
|
||||||
|
@ -247,7 +247,6 @@ mod tests {
|
|||||||
use alloc::{string::String, vec::Vec};
|
use alloc::{string::String, vec::Vec};
|
||||||
use core::any::TypeId;
|
use core::any::TypeId;
|
||||||
|
|
||||||
use crate as bevy_asset;
|
|
||||||
use crate::{Asset, AssetApp, AssetPlugin, ReflectAsset, UntypedHandle};
|
use crate::{Asset, AssetApp, AssetPlugin, ReflectAsset, UntypedHandle};
|
||||||
use bevy_app::App;
|
use bevy_app::App;
|
||||||
use bevy_ecs::reflect::AppTypeRegistry;
|
use bevy_ecs::reflect::AppTypeRegistry;
|
||||||
|
@ -352,7 +352,7 @@ mod tests {
|
|||||||
use bevy_reflect::TypePath;
|
use bevy_reflect::TypePath;
|
||||||
use bevy_tasks::block_on;
|
use bevy_tasks::block_on;
|
||||||
|
|
||||||
use crate::{self as bevy_asset, Asset};
|
use crate::Asset;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -1710,7 +1710,6 @@ fn sorted_remove<T: Eq + Ord + Copy>(source: &mut Vec<T>, remove: &[T]) {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{component::HookContext, prelude::*, world::DeferredWorld};
|
use crate::{component::HookContext, prelude::*, world::DeferredWorld};
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
|
|
||||||
|
@ -1268,7 +1268,6 @@ mod tests {
|
|||||||
use core::panic::Location;
|
use core::panic::Location;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
change_detection::{
|
change_detection::{
|
||||||
Mut, NonSendMut, Ref, ResMut, TicksMut, CHECK_TICK_THRESHOLD, MAX_CHANGE_AGE,
|
Mut, NonSendMut, Ref, ResMut, TicksMut, CHECK_TICK_THRESHOLD, MAX_CHANGE_AGE,
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Types for declaring and storing [`Component`]s.
|
//! Types for declaring and storing [`Component`]s.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
archetype::ArchetypeFlags,
|
archetype::ArchetypeFlags,
|
||||||
bundle::BundleInfo,
|
bundle::BundleInfo,
|
||||||
change_detection::MAX_CHANGE_AGE,
|
change_detection::MAX_CHANGE_AGE,
|
||||||
|
@ -816,12 +816,11 @@ impl<'w> EntityClonerBuilder<'w> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::ComponentCloneCtx;
|
use super::ComponentCloneCtx;
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
component::{Component, ComponentCloneBehavior, ComponentDescriptor, StorageType},
|
component::{Component, ComponentCloneBehavior, ComponentDescriptor, StorageType},
|
||||||
entity::{hash_map::EntityHashMap, Entity, EntityCloner},
|
entity::{hash_map::EntityHashMap, Entity, EntityCloner},
|
||||||
hierarchy::{ChildOf, Children},
|
prelude::{ChildOf, Children, Resource},
|
||||||
reflect::{AppTypeRegistry, ReflectComponent, ReflectFromWorld},
|
reflect::AppTypeRegistry,
|
||||||
resource::Resource,
|
reflect::{ReflectComponent, ReflectFromWorld},
|
||||||
system::Commands,
|
system::Commands,
|
||||||
world::{FromWorld, World},
|
world::{FromWorld, World},
|
||||||
};
|
};
|
||||||
@ -835,6 +834,7 @@ mod tests {
|
|||||||
mod reflect {
|
mod reflect {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
|
component::{Component, ComponentCloneBehavior},
|
||||||
entity::EntityCloner,
|
entity::EntityCloner,
|
||||||
reflect::{AppTypeRegistry, ReflectComponent, ReflectFromWorld},
|
reflect::{AppTypeRegistry, ReflectComponent, ReflectFromWorld},
|
||||||
system::Commands,
|
system::Commands,
|
||||||
|
@ -470,7 +470,6 @@ mod tests {
|
|||||||
use crate::query::{QueryState, With};
|
use crate::query::{QueryState, With};
|
||||||
use crate::system::Query;
|
use crate::system::Query;
|
||||||
use crate::world::Mut;
|
use crate::world::Mut;
|
||||||
use crate::{self as bevy_ecs};
|
|
||||||
|
|
||||||
use super::UniqueEntityIter;
|
use super::UniqueEntityIter;
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ impl VisitEntitiesMut for Entity {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
entity::{hash_map::EntityHashMap, MapEntities, SceneEntityMapper},
|
entity::{hash_map::EntityHashMap, MapEntities, SceneEntityMapper},
|
||||||
world::World,
|
world::World,
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
//! [`World`]: crate::prelude::World
|
//! [`World`]: crate::prelude::World
|
||||||
//! [`Query` performance]: crate::prelude::Query#performance
|
//! [`Query` performance]: crate::prelude::Query#performance
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
component::{ComponentId, Components, StorageType},
|
component::{ComponentId, Components, StorageType},
|
||||||
query::FilteredAccess,
|
query::FilteredAccess,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
use crate::component::ComponentId;
|
use crate::component::ComponentId;
|
||||||
use crate::world::World;
|
use crate::world::World;
|
||||||
use crate::{component::Component, traversal::Traversal};
|
use crate::{component::Component, traversal::Traversal};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
event::{Event, EventCursor, EventId, EventInstance},
|
event::{Event, EventCursor, EventId, EventInstance},
|
||||||
@ -398,7 +397,7 @@ impl<E: Event> ExactSizeIterator for SendBatchIds<E> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{self as bevy_ecs, event::Events};
|
use crate::event::Events;
|
||||||
use bevy_ecs_macros::Event;
|
use bevy_ecs_macros::Event;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
use bevy_ecs::event::{
|
use bevy_ecs::event::{
|
||||||
Event, EventIterator, EventIteratorWithId, EventMutIterator, EventMutIteratorWithId, Events,
|
Event, EventIterator, EventIteratorWithId, EventMutIterator, EventMutIteratorWithId, Events,
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
#[cfg(feature = "multi_threaded")]
|
#[cfg(feature = "multi_threaded")]
|
||||||
use bevy_ecs::batching::BatchingStrategy;
|
use bevy_ecs::batching::BatchingStrategy;
|
||||||
use bevy_ecs::event::{Event, EventCursor, EventId, EventInstance, Events};
|
use bevy_ecs::event::{Event, EventCursor, EventId, EventInstance, Events};
|
||||||
|
@ -31,7 +31,6 @@ pub use writer::EventWriter;
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use alloc::{vec, vec::Vec};
|
use alloc::{vec, vec::Vec};
|
||||||
use bevy_ecs::{event::*, system::assert_is_read_only_system};
|
use bevy_ecs::{event::*, system::assert_is_read_only_system};
|
||||||
use bevy_ecs_macros::Event;
|
use bevy_ecs_macros::Event;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
#[cfg(feature = "multi_threaded")]
|
#[cfg(feature = "multi_threaded")]
|
||||||
use bevy_ecs::batching::BatchingStrategy;
|
use bevy_ecs::batching::BatchingStrategy;
|
||||||
use bevy_ecs::event::{Event, EventCursor, EventId, EventInstance, Events};
|
use bevy_ecs::event::{Event, EventCursor, EventId, EventInstance, Events};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
#[cfg(feature = "multi_threaded")]
|
#[cfg(feature = "multi_threaded")]
|
||||||
use bevy_ecs::event::EventMutParIter;
|
use bevy_ecs::event::EventMutParIter;
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
#[cfg(feature = "multi_threaded")]
|
#[cfg(feature = "multi_threaded")]
|
||||||
use bevy_ecs::event::EventParIter;
|
use bevy_ecs::event::EventParIter;
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
change_detection::{DetectChangesMut, MutUntyped},
|
change_detection::{DetectChangesMut, MutUntyped},
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
change_detection::Mut,
|
change_detection::Mut,
|
||||||
component::Tick,
|
component::Tick,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_ecs;
|
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
event::{Event, EventId, Events, SendBatchIds},
|
event::{Event, EventId, Events, SendBatchIds},
|
||||||
system::{ResMut, SystemParam},
|
system::{ResMut, SystemParam},
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use crate::reflect::{ReflectComponent, ReflectFromWorld};
|
use crate::reflect::{ReflectComponent, ReflectFromWorld};
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
bundle::Bundle,
|
bundle::Bundle,
|
||||||
component::{Component, HookContext},
|
component::{Component, HookContext},
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
|
@ -201,7 +201,7 @@ mod tests {
|
|||||||
// and also Entity flag.
|
// and also Entity flag.
|
||||||
let high = 0x7FFFFFFF;
|
let high = 0x7FFFFFFF;
|
||||||
let low = 0xC;
|
let low = 0xC;
|
||||||
let bits: u64 = high << u32::BITS | low;
|
let bits: u64 = (high << u32::BITS) | low;
|
||||||
|
|
||||||
let id = Identifier::try_from_bits(bits).unwrap();
|
let id = Identifier::try_from_bits(bits).unwrap();
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ compile_error!("bevy_ecs cannot safely compile for a 16-bit platform.");
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
// Required to make proc macros work in bevy itself.
|
||||||
|
extern crate self as bevy_ecs;
|
||||||
|
|
||||||
pub mod archetype;
|
pub mod archetype;
|
||||||
pub mod batching;
|
pub mod batching;
|
||||||
pub mod bundle;
|
pub mod bundle;
|
||||||
@ -128,7 +131,6 @@ pub mod __macro_exports {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bundle::Bundle,
|
bundle::Bundle,
|
||||||
change_detection::Ref,
|
change_detection::Ref,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Provides the [`Name`] [`Component`], used for identifying an [`Entity`].
|
//! Provides the [`Name`] [`Component`], used for identifying an [`Entity`].
|
||||||
|
|
||||||
use crate::{self as bevy_ecs, component::Component, entity::Entity, query::QueryData};
|
use crate::{component::Component, entity::Entity, query::QueryData};
|
||||||
|
|
||||||
use alloc::{
|
use alloc::{
|
||||||
borrow::{Cow, ToOwned},
|
borrow::{Cow, ToOwned},
|
||||||
|
@ -110,8 +110,8 @@ fn component_clone_observed_by(commands: &mut Commands, ctx: &mut ComponentClone
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs, entity::EntityCloner, event::Event, observer::Trigger,
|
entity::EntityCloner, event::Event, observer::Trigger, resource::Resource, system::ResMut,
|
||||||
resource::Resource, system::ResMut, world::World,
|
world::World,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Resource, Default)]
|
#[derive(Resource, Default)]
|
||||||
|
@ -864,7 +864,6 @@ mod tests {
|
|||||||
use bevy_platform_support::collections::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
use bevy_ptr::OwningPtr;
|
use bevy_ptr::OwningPtr;
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::component::ComponentId;
|
use crate::component::ComponentId;
|
||||||
use crate::{
|
use crate::{
|
||||||
observer::{Observer, ObserverDescriptor, ObserverState, OnReplace},
|
observer::{Observer, ObserverDescriptor, ObserverState, OnReplace},
|
||||||
|
@ -275,7 +275,6 @@ impl<'w, D: QueryData, F: QueryFilter> QueryBuilder<'w, D, F> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{prelude::*, world::FilteredEntityRef};
|
use crate::{prelude::*, world::FilteredEntityRef};
|
||||||
use std::dbg;
|
use std::dbg;
|
||||||
|
|
||||||
|
@ -111,7 +111,6 @@ pub enum QuerySingleError {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::prelude::World;
|
use crate::prelude::World;
|
||||||
use alloc::format;
|
use alloc::format;
|
||||||
use bevy_ecs_macros::Component;
|
use bevy_ecs_macros::Component;
|
||||||
|
@ -2481,10 +2481,7 @@ mod tests {
|
|||||||
use bevy_ecs_macros::QueryData;
|
use bevy_ecs_macros::QueryData;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::system::{assert_is_system, Query};
|
||||||
self as bevy_ecs,
|
|
||||||
system::{assert_is_system, Query},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct A;
|
pub struct A;
|
||||||
|
@ -1309,7 +1309,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter, I: Iterator<Item: EntityBorrow>>
|
|||||||
/// // We need to collect the internal iterator before iterating mutably
|
/// // We need to collect the internal iterator before iterating mutably
|
||||||
/// let mut parent_query_iter = query.iter_many_mut(entity_list)
|
/// let mut parent_query_iter = query.iter_many_mut(entity_list)
|
||||||
/// .sort::<Entity>();
|
/// .sort::<Entity>();
|
||||||
///
|
///
|
||||||
/// let mut scratch_value = 0;
|
/// let mut scratch_value = 0;
|
||||||
/// while let Some(mut part_value) = parent_query_iter.fetch_next_back()
|
/// while let Some(mut part_value) = parent_query_iter.fetch_next_back()
|
||||||
/// {
|
/// {
|
||||||
@ -2582,7 +2582,6 @@ mod tests {
|
|||||||
use crate::component::Component;
|
use crate::component::Component;
|
||||||
use crate::entity::Entity;
|
use crate::entity::Entity;
|
||||||
use crate::prelude::World;
|
use crate::prelude::World;
|
||||||
use crate::{self as bevy_ecs};
|
|
||||||
|
|
||||||
#[derive(Component, Debug, PartialEq, PartialOrd, Clone, Copy)]
|
#[derive(Component, Debug, PartialEq, PartialOrd, Clone, Copy)]
|
||||||
struct A(f32);
|
struct A(f32);
|
||||||
|
@ -104,7 +104,6 @@ impl<T> DebugCheckedUnwrap for Option<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
archetype::Archetype,
|
archetype::Archetype,
|
||||||
component::{Component, ComponentId, Components, Tick},
|
component::{Component, ComponentId, Components, Tick},
|
||||||
prelude::{AnyOf, Changed, Entity, Or, QueryState, Res, ResMut, Resource, With, Without},
|
prelude::{AnyOf, Changed, Entity, Or, QueryState, Res, ResMut, Resource, With, Without},
|
||||||
|
@ -2010,7 +2010,6 @@ impl<D: QueryData, F: QueryFilter> From<QueryBuilder<'_, D, F>> for QueryState<D
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
component::Component, entity_disabling::DefaultQueryFilters, prelude::*,
|
component::Component, entity_disabling::DefaultQueryFilters, prelude::*,
|
||||||
query::QueryEntityError, world::FilteredEntityRef,
|
query::QueryEntityError, world::FilteredEntityRef,
|
||||||
|
@ -388,7 +388,6 @@ fn remove_reflect_with_registry_ref(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
bundle::Bundle,
|
bundle::Bundle,
|
||||||
component::Component,
|
component::Component,
|
||||||
prelude::{AppTypeRegistry, ReflectComponent},
|
prelude::{AppTypeRegistry, ReflectComponent},
|
||||||
|
@ -5,7 +5,6 @@ use core::{
|
|||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{resource::Resource, world::World};
|
use crate::{resource::Resource, world::World};
|
||||||
use bevy_reflect::{
|
use bevy_reflect::{
|
||||||
std_traits::ReflectDefault, PartialReflect, Reflect, ReflectFromReflect, TypePath,
|
std_traits::ReflectDefault, PartialReflect, Reflect, ReflectFromReflect, TypePath,
|
||||||
|
@ -286,7 +286,6 @@ pub fn clone_relationship_target<T: RelationshipTarget>(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::world::World;
|
use crate::world::World;
|
||||||
use crate::{component::Component, entity::Entity};
|
use crate::{component::Component, entity::Entity};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
@ -249,7 +249,6 @@ impl<'w, R: Relationship> RelatedSpawnerCommands<'w, R> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::prelude::{ChildOf, Children, Component};
|
use crate::prelude::{ChildOf, Children, Component};
|
||||||
|
|
||||||
#[derive(Component, Clone, Copy)]
|
#[derive(Component, Clone, Copy)]
|
||||||
|
@ -119,7 +119,6 @@ impl<const N: usize> RelationshipSourceCollection for SmallVec<[Entity; N]> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::prelude::{Component, World};
|
use crate::prelude::{Component, World};
|
||||||
use crate::relationship::RelationshipTarget;
|
use crate::relationship::RelationshipTarget;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Alerting events when a component is removed from an entity.
|
//! Alerting events when a component is removed from an entity.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
component::{Component, ComponentId, ComponentIdFor, Tick},
|
component::{Component, ComponentId, ComponentIdFor, Tick},
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
event::{Event, EventCursor, EventId, EventIterator, EventIteratorWithId, Events},
|
event::{Event, EventCursor, EventId, EventIterator, EventIteratorWithId, Events},
|
||||||
|
@ -1263,7 +1263,6 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{common_conditions::*, Condition};
|
use super::{common_conditions::*, Condition};
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::query::With;
|
use crate::query::With;
|
||||||
use crate::{
|
use crate::{
|
||||||
change_detection::ResMut,
|
change_detection::ResMut,
|
||||||
|
@ -311,7 +311,6 @@ mod __rust_begin_short_backtrace {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
prelude::{IntoSystemConfigs, IntoSystemSetConfigs, Resource, Schedule, SystemSet},
|
prelude::{IntoSystemConfigs, IntoSystemSetConfigs, Resource, Schedule, SystemSet},
|
||||||
schedule::ExecutorKind,
|
schedule::ExecutorKind,
|
||||||
system::{Commands, Res, WithParamWarnPolicy},
|
system::{Commands, Res, WithParamWarnPolicy},
|
||||||
|
@ -22,8 +22,6 @@ use crate::{
|
|||||||
world::{unsafe_world_cell::UnsafeWorldCell, World},
|
world::{unsafe_world_cell::UnsafeWorldCell, World},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
|
|
||||||
use super::__rust_begin_short_backtrace;
|
use super::__rust_begin_short_backtrace;
|
||||||
|
|
||||||
/// Borrowed data used by the [`MultiThreadedExecutor`].
|
/// Borrowed data used by the [`MultiThreadedExecutor`].
|
||||||
@ -796,7 +794,6 @@ impl MainThreadExecutor {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
prelude::Resource,
|
prelude::Resource,
|
||||||
schedule::{ExecutorKind, IntoSystemConfigs, Schedule},
|
schedule::{ExecutorKind, IntoSystemConfigs, Schedule},
|
||||||
system::Commands,
|
system::Commands,
|
||||||
|
@ -29,7 +29,6 @@ mod tests {
|
|||||||
use alloc::{string::ToString, vec, vec::Vec};
|
use alloc::{string::ToString, vec, vec::Vec};
|
||||||
use core::sync::atomic::{AtomicU32, Ordering};
|
use core::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
||||||
pub use crate as bevy_ecs;
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
prelude::World,
|
prelude::World,
|
||||||
resource::Resource,
|
resource::Resource,
|
||||||
@ -730,8 +729,6 @@ mod tests {
|
|||||||
use alloc::collections::BTreeSet;
|
use alloc::collections::BTreeSet;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
// Required to make the derive macro behave
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
|
@ -25,7 +25,6 @@ use thiserror::Error;
|
|||||||
use tracing::info_span;
|
use tracing::info_span;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
component::{ComponentId, Components, Tick},
|
component::{ComponentId, Components, Tick},
|
||||||
prelude::Component,
|
prelude::Component,
|
||||||
resource::Resource,
|
resource::Resource,
|
||||||
@ -2020,7 +2019,6 @@ mod tests {
|
|||||||
use bevy_ecs_macros::ScheduleLabel;
|
use bevy_ecs_macros::ScheduleLabel;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
prelude::{Res, Resource},
|
prelude::{Res, Resource},
|
||||||
schedule::{
|
schedule::{
|
||||||
tests::ResMut, IntoSystemConfigs, IntoSystemSetConfigs, Schedule,
|
tests::ResMut, IntoSystemConfigs, IntoSystemSetConfigs, Schedule,
|
||||||
|
@ -225,7 +225,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_schedule_label() {
|
fn test_schedule_label() {
|
||||||
use crate::{self as bevy_ecs, world::World};
|
use crate::world::World;
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
struct Flag(bool);
|
struct Flag(bool);
|
||||||
@ -257,8 +257,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_derive_schedule_label() {
|
fn test_derive_schedule_label() {
|
||||||
use crate::{self as bevy_ecs};
|
|
||||||
|
|
||||||
#[derive(ScheduleLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(ScheduleLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
struct UnitLabel;
|
struct UnitLabel;
|
||||||
|
|
||||||
@ -359,8 +357,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_derive_system_set() {
|
fn test_derive_system_set() {
|
||||||
use crate::{self as bevy_ecs};
|
|
||||||
|
|
||||||
#[derive(SystemSet, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(SystemSet, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
struct UnitSet;
|
struct UnitSet;
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ use log::error;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
|
#[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
|
||||||
enum Action {
|
enum Action {
|
||||||
/// Stepping is disabled; run all systems
|
/// Stepping is disabled; run all systems
|
||||||
@ -831,8 +829,6 @@ mod tests {
|
|||||||
use alloc::{format, vec};
|
use alloc::{format, vec};
|
||||||
use std::println;
|
use std::println;
|
||||||
|
|
||||||
pub use crate as bevy_ecs;
|
|
||||||
|
|
||||||
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
|
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
struct TestSchedule;
|
struct TestSchedule;
|
||||||
|
|
||||||
|
@ -479,7 +479,6 @@ impl BlobArray {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use bevy_ecs::prelude::*;
|
use bevy_ecs::prelude::*;
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
|
@ -498,7 +498,6 @@ const fn padding_needed_for(layout: &Layout, align: usize) -> usize {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::BlobVec;
|
use super::BlobVec;
|
||||||
use crate as bevy_ecs; // required for derive macros
|
|
||||||
use crate::{component::Component, ptr::OwningPtr, world::World};
|
use crate::{component::Component, ptr::OwningPtr, world::World};
|
||||||
use alloc::{
|
use alloc::{
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
|
@ -661,7 +661,6 @@ impl SparseSets {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::SparseSets;
|
use super::SparseSets;
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
component::{Component, ComponentDescriptor, ComponentId, ComponentInfo},
|
component::{Component, ComponentDescriptor, ComponentId, ComponentInfo},
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
storage::SparseSet,
|
storage::SparseSet,
|
||||||
|
@ -815,7 +815,6 @@ impl Drop for Table {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
component::{Component, Components, Tick},
|
component::{Component, Components, Tick},
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
|
@ -712,7 +712,6 @@ unsafe impl<'w, 's, T: FnOnce(&mut FilteredResourcesMutBuilder)>
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
entity::Entities,
|
entity::Entities,
|
||||||
prelude::{Component, Query},
|
prelude::{Component, Query},
|
||||||
|
@ -17,7 +17,6 @@ use core::panic::Location;
|
|||||||
use log::error;
|
use log::error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
bundle::{Bundle, InsertMode},
|
bundle::{Bundle, InsertMode},
|
||||||
change_detection::Mut,
|
change_detection::Mut,
|
||||||
component::{Component, ComponentId, Mutable},
|
component::{Component, ComponentId, Mutable},
|
||||||
@ -2203,7 +2202,6 @@ impl<'a, T: Component> EntityEntryCommands<'a, T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
component::{require, Component},
|
component::{require, Component},
|
||||||
resource::Resource,
|
resource::Resource,
|
||||||
system::Commands,
|
system::Commands,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use bevy_utils::Parallel;
|
use bevy_utils::Parallel;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
entity::Entities,
|
entity::Entities,
|
||||||
prelude::World,
|
prelude::World,
|
||||||
system::{Deferred, SystemBuffer, SystemMeta, SystemParam},
|
system::{Deferred, SystemBuffer, SystemMeta, SystemParam},
|
||||||
|
@ -136,7 +136,6 @@ all_tuples!(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::{schedule::Schedule, system::Local, world::World};
|
use crate::{schedule::Schedule, system::Local, world::World};
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use bevy_ecs_macros::Resource;
|
use bevy_ecs_macros::Resource;
|
||||||
|
@ -330,7 +330,6 @@ mod tests {
|
|||||||
use std::println;
|
use std::println;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
archetype::{ArchetypeComponentId, Archetypes},
|
archetype::{ArchetypeComponentId, Archetypes},
|
||||||
bundle::Bundles,
|
bundle::Bundles,
|
||||||
change_detection::DetectChanges,
|
change_detection::DetectChanges,
|
||||||
|
@ -60,7 +60,6 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
event::Event,
|
event::Event,
|
||||||
observer::Trigger,
|
observer::Trigger,
|
||||||
system::{In, IntoSystem},
|
system::{In, IntoSystem},
|
||||||
|
@ -381,7 +381,6 @@ impl Debug for RunSystemError {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_ecs;
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2582,10 +2582,7 @@ unsafe impl SystemParam for FilteredResourcesMut<'_, '_> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::system::assert_is_system;
|
||||||
self as bevy_ecs, // Necessary for the `SystemParam` Derive when used inside `bevy_ecs`.
|
|
||||||
system::assert_is_system,
|
|
||||||
};
|
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
|
|
||||||
// Compile test for https://github.com/bevyengine/bevy/pull/2838.
|
// Compile test for https://github.com/bevyengine/bevy/pull/2838.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use crate::reflect::ReflectComponent;
|
use crate::reflect::ReflectComponent;
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
change_detection::Mut,
|
change_detection::Mut,
|
||||||
entity::Entity,
|
entity::Entity,
|
||||||
system::{input::SystemInput, BoxedSystem, IntoSystem, System},
|
system::{input::SystemInput, BoxedSystem, IntoSystem, System},
|
||||||
@ -498,7 +497,6 @@ impl<I: SystemInput, O> core::fmt::Debug for RegisteredSystemError<I, O> {
|
|||||||
|
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::{self as bevy_ecs};
|
|
||||||
|
|
||||||
#[derive(Resource, Default, PartialEq, Debug)]
|
#[derive(Resource, Default, PartialEq, Debug)]
|
||||||
struct Counter(u8);
|
struct Counter(u8);
|
||||||
|
@ -335,7 +335,7 @@ impl SystemBuffer for CommandQueue {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{self as bevy_ecs, resource::Resource};
|
use crate::resource::Resource;
|
||||||
use alloc::{borrow::ToOwned, string::String, sync::Arc};
|
use alloc::{borrow::ToOwned, string::String, sync::Arc};
|
||||||
use core::{
|
use core::{
|
||||||
panic::AssertUnwindSafe,
|
panic::AssertUnwindSafe,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! Internal components used by bevy with a fixed component id.
|
//! Internal components used by bevy with a fixed component id.
|
||||||
//! Constants are used to skip [`TypeId`] lookups in hot paths.
|
//! Constants are used to skip [`TypeId`] lookups in hot paths.
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{self as bevy_ecs};
|
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
|
|
||||||
|
@ -4417,7 +4417,6 @@ mod tests {
|
|||||||
|
|
||||||
use crate::component::HookContext;
|
use crate::component::HookContext;
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_ecs,
|
|
||||||
change_detection::MutUntyped,
|
change_detection::MutUntyped,
|
||||||
component::ComponentId,
|
component::ComponentId,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
@ -3763,9 +3763,6 @@ mod tests {
|
|||||||
};
|
};
|
||||||
use std::{println, sync::Mutex};
|
use std::{println, sync::Mutex};
|
||||||
|
|
||||||
// For bevy_ecs_macros
|
|
||||||
use crate as bevy_ecs;
|
|
||||||
|
|
||||||
type ID = u8;
|
type ID = u8;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
@ -251,11 +251,7 @@ mod tests {
|
|||||||
|
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
|
|
||||||
use crate::{
|
use crate::prelude::{AppTypeRegistry, Component, DetectChanges, World};
|
||||||
// For bevy_ecs_macros
|
|
||||||
self as bevy_ecs,
|
|
||||||
prelude::{AppTypeRegistry, Component, DetectChanges, World},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Component, Reflect)]
|
#[derive(Component, Reflect)]
|
||||||
struct RFoo(i32);
|
struct RFoo(i32);
|
||||||
|
@ -1222,7 +1222,6 @@ impl EntityBorrow for UnsafeEntityCell<'_> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_ecs;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic = "is forbidden"]
|
#[should_panic = "is forbidden"]
|
||||||
|
@ -31,7 +31,7 @@ fn bevy_encase_path() -> syn::Path {
|
|||||||
segments,
|
segments,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| bevy_manifest.get_path(ENCASE))
|
.unwrap_or_else(|_err| bevy_manifest.get_path(ENCASE))
|
||||||
}
|
}
|
||||||
|
|
||||||
implement!(bevy_encase_path());
|
implement!(bevy_encase_path());
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
//! A module adding debug visualization of [`Aabb`]s.
|
//! A module adding debug visualization of [`Aabb`]s.
|
||||||
|
|
||||||
use crate as bevy_gizmos;
|
|
||||||
|
|
||||||
use bevy_app::{Plugin, PostUpdate};
|
use bevy_app::{Plugin, PostUpdate};
|
||||||
use bevy_color::{Color, Oklcha};
|
use bevy_color::{Color, Oklcha};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
//! A module for the [`GizmoConfig<T>`] [`Resource`].
|
//! A module for the [`GizmoConfig<T>`] [`Resource`].
|
||||||
|
|
||||||
use crate::{self as bevy_gizmos};
|
|
||||||
pub use bevy_gizmos_macros::GizmoConfigGroup;
|
pub use bevy_gizmos_macros::GizmoConfigGroup;
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
//!
|
//!
|
||||||
//! See the documentation on [Gizmos](crate::gizmos::Gizmos) for more examples.
|
//! See the documentation on [Gizmos](crate::gizmos::Gizmos) for more examples.
|
||||||
|
|
||||||
|
// Required to make proc macros work in bevy itself.
|
||||||
|
extern crate self as bevy_gizmos;
|
||||||
|
|
||||||
/// System set label for the systems handling the rendering of gizmos.
|
/// System set label for the systems handling the rendering of gizmos.
|
||||||
#[derive(SystemSet, Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(SystemSet, Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub enum GizmoRenderSystem {
|
pub enum GizmoRenderSystem {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use core::f32::consts::PI;
|
use core::f32::consts::PI;
|
||||||
|
|
||||||
use crate::{self as bevy_gizmos, primitives::dim3::GizmoPrimitive3d};
|
use crate::primitives::dim3::GizmoPrimitive3d;
|
||||||
|
|
||||||
use bevy_app::{Plugin, PostUpdate};
|
use bevy_app::{Plugin, PostUpdate};
|
||||||
use bevy_color::{
|
use bevy_color::{
|
||||||
|
@ -9,12 +9,10 @@ license = "MIT OR Apache-2.0"
|
|||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
toml_edit = { version = "0.22.7", default-features = false, features = [
|
|
||||||
"parse",
|
|
||||||
] }
|
|
||||||
syn = "2.0"
|
syn = "2.0"
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
proc-macro2 = "1.0"
|
proc-macro2 = "1.0"
|
||||||
|
cargo-manifest-proc-macros = "0.3.3"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
@ -1,83 +1,55 @@
|
|||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use std::sync::MutexGuard;
|
||||||
use std::{env, path::PathBuf, sync::LazyLock};
|
|
||||||
use toml_edit::{DocumentMut, Item};
|
|
||||||
|
|
||||||
/// The path to the `Cargo.toml` file for the Bevy project.
|
use cargo_manifest_proc_macros::{
|
||||||
pub struct BevyManifest {
|
CargoManifest, CrateReExportingPolicy, KnownReExportingCrate, PathPiece,
|
||||||
manifest: DocumentMut,
|
TryResolveCratePathError,
|
||||||
|
};
|
||||||
|
use proc_macro::TokenStream;
|
||||||
|
|
||||||
|
struct BevyReExportingPolicy;
|
||||||
|
|
||||||
|
impl CrateReExportingPolicy for BevyReExportingPolicy {
|
||||||
|
fn get_re_exported_crate_path(&self, crate_name: &str) -> Option<PathPiece> {
|
||||||
|
crate_name.strip_prefix("bevy_").map(|s| {
|
||||||
|
let mut path = PathPiece::new();
|
||||||
|
path.push(syn::parse_str::<syn::PathSegment>(s).unwrap());
|
||||||
|
path
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BEVY: &str = "bevy";
|
const BEVY: &str = "bevy";
|
||||||
const BEVY_INTERNAL: &str = "bevy_internal";
|
|
||||||
|
const KNOWN_RE_EXPORTING_CRATE_BEVY: KnownReExportingCrate = KnownReExportingCrate {
|
||||||
|
re_exporting_crate_package_name: BEVY,
|
||||||
|
crate_re_exporting_policy: &BevyReExportingPolicy {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const ALL_KNOWN_RE_EXPORTING_CRATES: &[&KnownReExportingCrate] = &[&KNOWN_RE_EXPORTING_CRATE_BEVY];
|
||||||
|
|
||||||
|
/// The path to the `Cargo.toml` file for the Bevy project.
|
||||||
|
pub struct BevyManifest(MutexGuard<'static, CargoManifest>);
|
||||||
|
|
||||||
impl BevyManifest {
|
impl BevyManifest {
|
||||||
/// Returns a global shared instance of the [`BevyManifest`] struct.
|
/// Returns a global shared instance of the [`BevyManifest`] struct.
|
||||||
pub fn shared() -> &'static LazyLock<Self> {
|
pub fn shared() -> Self {
|
||||||
static LAZY_SELF: LazyLock<BevyManifest> = LazyLock::new(|| BevyManifest {
|
Self(CargoManifest::shared())
|
||||||
manifest: env::var_os("CARGO_MANIFEST_DIR")
|
|
||||||
.map(PathBuf::from)
|
|
||||||
.map(|mut path| {
|
|
||||||
path.push("Cargo.toml");
|
|
||||||
if !path.exists() {
|
|
||||||
panic!(
|
|
||||||
"No Cargo manifest found for crate. Expected: {}",
|
|
||||||
path.display()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let manifest = std::fs::read_to_string(path.clone()).unwrap_or_else(|_| {
|
|
||||||
panic!("Unable to read cargo manifest: {}", path.display())
|
|
||||||
});
|
|
||||||
manifest.parse::<DocumentMut>().unwrap_or_else(|_| {
|
|
||||||
panic!("Failed to parse cargo manifest: {}", path.display())
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.expect("CARGO_MANIFEST_DIR is not defined."),
|
|
||||||
});
|
|
||||||
&LAZY_SELF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to retrieve the [path](syn::Path) of a particular package in
|
/// Attempt to retrieve the [path](syn::Path) of a particular package in
|
||||||
/// the [manifest](BevyManifest) by [name](str).
|
/// the [manifest](BevyManifest) by [name](str).
|
||||||
pub fn maybe_get_path(&self, name: &str) -> Option<syn::Path> {
|
pub fn maybe_get_path(&self, name: &str) -> Result<syn::Path, TryResolveCratePathError> {
|
||||||
fn dep_package(dep: &Item) -> Option<&str> {
|
self.0
|
||||||
if dep.as_str().is_some() {
|
.try_resolve_crate_path(name, ALL_KNOWN_RE_EXPORTING_CRATES)
|
||||||
None
|
|
||||||
} else {
|
|
||||||
dep.get("package").map(|name| name.as_str().unwrap())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let find_in_deps = |deps: &Item| -> Option<syn::Path> {
|
|
||||||
let package = if let Some(dep) = deps.get(name) {
|
|
||||||
return Some(Self::parse_str(dep_package(dep).unwrap_or(name)));
|
|
||||||
} else if let Some(dep) = deps.get(BEVY) {
|
|
||||||
dep_package(dep).unwrap_or(BEVY)
|
|
||||||
} else if let Some(dep) = deps.get(BEVY_INTERNAL) {
|
|
||||||
dep_package(dep).unwrap_or(BEVY_INTERNAL)
|
|
||||||
} else {
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut path = Self::parse_str::<syn::Path>(package);
|
|
||||||
if let Some(module) = name.strip_prefix("bevy_") {
|
|
||||||
path.segments.push(Self::parse_str(module));
|
|
||||||
}
|
|
||||||
Some(path)
|
|
||||||
};
|
|
||||||
|
|
||||||
let deps = self.manifest.get("dependencies");
|
|
||||||
let deps_dev = self.manifest.get("dev-dependencies");
|
|
||||||
|
|
||||||
deps.and_then(find_in_deps)
|
|
||||||
.or_else(|| deps_dev.and_then(find_in_deps))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the path for the crate with the given name.
|
/// Returns the path for the crate with the given name.
|
||||||
pub fn get_path(&self, name: &str) -> syn::Path {
|
pub fn get_path(&self, name: &str) -> syn::Path {
|
||||||
self.maybe_get_path(name)
|
self.maybe_get_path(name)
|
||||||
.unwrap_or_else(|| Self::parse_str(name))
|
//.expect("Failed to get path for crate")
|
||||||
|
.unwrap_or_else(|_err| Self::parse_str(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to parse the provided [path](str) as a [syntax tree node](syn::parse::Parse)
|
/// Attempt to parse the provided [path](str) as a [syntax tree node](syn::parse::Parse)
|
||||||
@ -97,7 +69,7 @@ impl BevyManifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to get a subcrate [path](syn::Path) under Bevy by [name](str)
|
/// Attempt to get a subcrate [path](syn::Path) under Bevy by [name](str)
|
||||||
pub fn get_subcrate(&self, subcrate: &str) -> Option<syn::Path> {
|
pub fn get_subcrate(&self, subcrate: &str) -> Result<syn::Path, TryResolveCratePathError> {
|
||||||
self.maybe_get_path(BEVY)
|
self.maybe_get_path(BEVY)
|
||||||
.map(|bevy_path| {
|
.map(|bevy_path| {
|
||||||
let mut segments = bevy_path.segments;
|
let mut segments = bevy_path.segments;
|
||||||
@ -107,6 +79,6 @@ impl BevyManifest {
|
|||||||
segments,
|
segments,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.or_else(|| self.maybe_get_path(&format!("bevy_{subcrate}")))
|
.or_else(|_err| self.maybe_get_path(&format!("bevy_{subcrate}")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
use bevy_macro_utils::{
|
use bevy_macro_utils::fq_std::{FQClone, FQOption, FQResult};
|
||||||
fq_std::{FQClone, FQOption, FQResult},
|
|
||||||
BevyManifest,
|
|
||||||
};
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::{parse::Parse, parse_macro_input, Attribute, ItemTrait, Token};
|
use syn::{parse::Parse, parse_macro_input, Attribute, ItemTrait, Token};
|
||||||
@ -34,7 +31,7 @@ pub(crate) fn reflect_trait(_args: &TokenStream, input: TokenStream) -> TokenStr
|
|||||||
let trait_ident = &item_trait.ident;
|
let trait_ident = &item_trait.ident;
|
||||||
let trait_vis = &item_trait.vis;
|
let trait_vis = &item_trait.vis;
|
||||||
let reflect_trait_ident = crate::ident::get_reflect_ident(&item_trait.ident.to_string());
|
let reflect_trait_ident = crate::ident::get_reflect_ident(&item_trait.ident.to_string());
|
||||||
let bevy_reflect_path = BevyManifest::shared().get_path("bevy_reflect");
|
let bevy_reflect_path = crate::meta::get_bevy_reflect_path();
|
||||||
|
|
||||||
let struct_doc = format!(
|
let struct_doc = format!(
|
||||||
" A type generated by the #[reflect_trait] macro for the `{trait_ident}` trait.\n\n This allows casting from `dyn Reflect` to `dyn {trait_ident}`.",
|
" A type generated by the #[reflect_trait] macro for the `{trait_ident}` trait.\n\n This allows casting from `dyn Reflect` to `dyn {trait_ident}`.",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use crate::generics::impl_generic_info_methods;
|
use crate::generics::impl_generic_info_methods;
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_reflect, type_info::impl_type_methods, utility::reflect_hasher, ApplyError,
|
type_info::impl_type_methods, utility::reflect_hasher, ApplyError, Generics, MaybeTyped,
|
||||||
Generics, MaybeTyped, PartialReflect, Reflect, ReflectKind, ReflectMut, ReflectOwned,
|
PartialReflect, Reflect, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, Type, TypeInfo,
|
||||||
ReflectRef, Type, TypeInfo, TypePath,
|
TypePath,
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, vec::Vec};
|
use alloc::{boxed::Box, vec::Vec};
|
||||||
use bevy_reflect_derive::impl_type_path;
|
use bevy_reflect_derive::impl_type_path;
|
||||||
|
@ -178,7 +178,6 @@ pub(crate) use impl_custom_attribute_methods;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_reflect;
|
|
||||||
use crate::{type_info::Typed, TypeInfo, VariantInfo};
|
use crate::{type_info::Typed, TypeInfo, VariantInfo};
|
||||||
use alloc::{format, string::String};
|
use alloc::{format, string::String};
|
||||||
use core::ops::RangeInclusive;
|
use core::ops::RangeInclusive;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use bevy_reflect_derive::impl_type_path;
|
use bevy_reflect_derive::impl_type_path;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_reflect, enum_debug, enum_hash, enum_partial_eq, ApplyError, DynamicStruct,
|
enum_debug, enum_hash, enum_partial_eq, ApplyError, DynamicStruct, DynamicTuple, Enum,
|
||||||
DynamicTuple, Enum, PartialReflect, Reflect, ReflectKind, ReflectMut, ReflectOwned, ReflectRef,
|
PartialReflect, Reflect, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, Struct, Tuple,
|
||||||
Struct, Tuple, TypeInfo, VariantFieldIter, VariantType,
|
TypeInfo, VariantFieldIter, VariantType,
|
||||||
};
|
};
|
||||||
|
|
||||||
use alloc::{boxed::Box, string::String};
|
use alloc::{boxed::Box, string::String};
|
||||||
|
@ -317,7 +317,6 @@ impl<'a> VariantField<'a> {
|
|||||||
// Tests that need access to internal fields have to go here rather than in mod.rs
|
// Tests that need access to internal fields have to go here rather than in mod.rs
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_reflect;
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
#[derive(Reflect, Debug, PartialEq)]
|
#[derive(Reflect, Debug, PartialEq)]
|
||||||
|
@ -10,7 +10,6 @@ pub use variants::*;
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate as bevy_reflect;
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
|
||||||
|
@ -359,7 +359,6 @@ impl UnitVariantInfo {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_reflect;
|
|
||||||
use crate::{Reflect, Typed};
|
use crate::{Reflect, Typed};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_reflect,
|
|
||||||
__macro_exports::RegisterForReflection,
|
__macro_exports::RegisterForReflection,
|
||||||
func::{
|
func::{
|
||||||
args::{ArgCount, ArgList},
|
args::{ArgCount, ArgList},
|
||||||
|
@ -252,7 +252,6 @@ pub(crate) use impl_generic_info_methods;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate as bevy_reflect;
|
|
||||||
use crate::{Reflect, Typed};
|
use crate::{Reflect, Typed};
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{self as bevy_reflect, impl_type_path};
|
use crate::impl_type_path;
|
||||||
|
|
||||||
impl_type_path!(::foldhash::fast::FoldHasher);
|
impl_type_path!(::foldhash::fast::FoldHasher);
|
||||||
impl_type_path!(::foldhash::fast::FixedState);
|
impl_type_path!(::foldhash::fast::FixedState);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use crate as bevy_reflect;
|
|
||||||
use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
||||||
use assert_type_match::assert_type_match;
|
use assert_type_match::assert_type_match;
|
||||||
use bevy_reflect_derive::{impl_reflect, impl_reflect_opaque};
|
use bevy_reflect_derive::{impl_reflect, impl_reflect_opaque};
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
use crate::{
|
use crate::{impl_reflect_opaque, prelude::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
||||||
self as bevy_reflect, impl_reflect_opaque, prelude::ReflectDefault, ReflectDeserialize,
|
|
||||||
ReflectSerialize,
|
|
||||||
};
|
|
||||||
|
|
||||||
impl_reflect_opaque!(::petgraph::graph::NodeIndex(
|
impl_reflect_opaque!(::petgraph::graph::NodeIndex(
|
||||||
Default,
|
Default,
|
||||||
|
@ -4,10 +4,10 @@ use core::any::Any;
|
|||||||
use smallvec::{Array as SmallArray, SmallVec};
|
use smallvec::{Array as SmallArray, SmallVec};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_reflect, utility::GenericTypeInfoCell, ApplyError, FromReflect, FromType,
|
utility::GenericTypeInfoCell, ApplyError, FromReflect, FromType, Generics, GetTypeRegistration,
|
||||||
Generics, GetTypeRegistration, List, ListInfo, ListIter, MaybeTyped, PartialReflect, Reflect,
|
List, ListInfo, ListIter, MaybeTyped, PartialReflect, Reflect, ReflectFromPtr, ReflectKind,
|
||||||
ReflectFromPtr, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, TypeInfo, TypeParamInfo,
|
ReflectMut, ReflectOwned, ReflectRef, TypeInfo, TypeParamInfo, TypePath, TypeRegistration,
|
||||||
TypePath, TypeRegistration, Typed,
|
Typed,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl<T: SmallArray + TypePath + Send + Sync> List for SmallVec<T>
|
impl<T: SmallArray + TypePath + Send + Sync> List for SmallVec<T>
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use crate::{
|
use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
||||||
self as bevy_reflect, std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize,
|
|
||||||
};
|
|
||||||
use bevy_reflect_derive::impl_reflect_opaque;
|
use bevy_reflect_derive::impl_reflect_opaque;
|
||||||
|
|
||||||
impl_reflect_opaque!(::smol_str::SmolStr(
|
impl_reflect_opaque!(::smol_str::SmolStr(
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
)]
|
)]
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_reflect, impl_type_path, map_apply, map_partial_eq, map_try_apply,
|
impl_type_path, map_apply, map_partial_eq, map_try_apply,
|
||||||
prelude::ReflectDefault,
|
prelude::ReflectDefault,
|
||||||
reflect::impl_full_reflect,
|
reflect::impl_full_reflect,
|
||||||
set_apply, set_partial_eq, set_try_apply,
|
set_apply, set_partial_eq, set_try_apply,
|
||||||
@ -2441,8 +2441,8 @@ crate::func::macros::impl_function_traits!(&'static Location<'static>);
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
self as bevy_reflect, Enum, FromReflect, PartialReflect, Reflect, ReflectSerialize,
|
Enum, FromReflect, PartialReflect, Reflect, ReflectSerialize, TypeInfo, TypeRegistry,
|
||||||
TypeInfo, TypeRegistry, Typed, VariantInfo, VariantType,
|
Typed, VariantInfo, VariantType,
|
||||||
};
|
};
|
||||||
use alloc::{collections::BTreeMap, string::String, vec};
|
use alloc::{collections::BTreeMap, string::String, vec};
|
||||||
use bevy_platform_support::collections::HashMap;
|
use bevy_platform_support::collections::HashMap;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use crate as bevy_reflect;
|
|
||||||
|
|
||||||
use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize};
|
||||||
use bevy_reflect_derive::impl_reflect_opaque;
|
use bevy_reflect_derive::impl_reflect_opaque;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user