Simpler lint fixes: makes ci lints work but disables a lint for now (#15376)

Takes the first two commits from #15375 and adds suggestions from this
comment:
https://github.com/bevyengine/bevy/pull/15375#issuecomment-2366968300

See #15375 for more reasoning/motivation.

## Rebasing (rerunning)

```rust
git switch simpler-lint-fixes
git reset --hard main
cargo fmt --all -- --unstable-features --config normalize_comments=true,imports_granularity=Crate
cargo fmt --all
git add --update
git commit --message "rustfmt"
cargo clippy --workspace --all-targets --all-features --fix
cargo fmt --all -- --unstable-features --config normalize_comments=true,imports_granularity=Crate
cargo fmt --all
git add --update
git commit --message "clippy"
git cherry-pick e6c0b94f6795222310fb812fa5c4512661fc7887
```
This commit is contained in:
Clar Fon 2024-09-24 07:42:59 -04:00 committed by GitHub
parent 1d9ee56457
commit efda7f3f9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
373 changed files with 1615 additions and 1345 deletions

View file

@ -45,6 +45,9 @@ ptr_as_ptr = "warn"
ptr_cast_constness = "warn" ptr_cast_constness = "warn"
ref_as_ptr = "warn" ref_as_ptr = "warn"
# see: https://github.com/bevyengine/bevy/pull/15375#issuecomment-2366966219
too_long_first_doc_paragraph = "allow"
[workspace.lints.rust] [workspace.lints.rust]
missing_docs = "warn" missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] } unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }

View file

@ -21,8 +21,7 @@ use bevy_ecs::{
schedule::SystemSet, schedule::SystemSet,
system::Resource, system::Resource,
}; };
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect;
/// Wrapper struct for [`accesskit::ActionRequest`]. Required to allow it to be used as an `Event`. /// Wrapper struct for [`accesskit::ActionRequest`]. Required to allow it to be used as an `Event`.
#[derive(Event, Deref, DerefMut)] #[derive(Event, Deref, DerefMut)]

View file

@ -1,7 +1,9 @@
//! The animation graph, which allows animations to be blended together. //! The animation graph, which allows animations to be blended together.
use std::io::{self, Write}; use std::{
use std::ops::{Index, IndexMut}; io::{self, Write},
ops::{Index, IndexMut},
};
use bevy_asset::{io::Reader, Asset, AssetId, AssetLoader, AssetPath, Handle, LoadContext}; use bevy_asset::{io::Reader, Asset, AssetId, AssetLoader, AssetPath, Handle, LoadContext};
use bevy_reflect::{Reflect, ReflectSerialize}; use bevy_reflect::{Reflect, ReflectSerialize};

View file

@ -1,20 +1,27 @@
//! Keyframes of animation clips. //! Keyframes of animation clips.
use std::any::TypeId; use std::{
use std::fmt::{self, Debug, Formatter}; any::TypeId,
fmt::{self, Debug, Formatter},
};
use bevy_asset::Handle; use bevy_asset::Handle;
use bevy_derive::{Deref, DerefMut}; use bevy_derive::{Deref, DerefMut};
use bevy_ecs::component::Component; use bevy_ecs::{
use bevy_ecs::world::{EntityMutExcept, Mut}; component::Component,
world::{EntityMutExcept, Mut},
};
use bevy_math::{Quat, Vec3}; use bevy_math::{Quat, Vec3};
use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath, Typed}; use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath, Typed};
use bevy_render::mesh::morph::MorphWeights; use bevy_render::mesh::morph::MorphWeights;
use bevy_transform::prelude::Transform; use bevy_transform::prelude::Transform;
use crate::graph::AnimationGraph; use crate::{
use crate::prelude::{Animatable, GetKeyframe}; animatable,
use crate::{animatable, AnimationEvaluationError, AnimationPlayer, Interpolation}; graph::AnimationGraph,
prelude::{Animatable, GetKeyframe},
AnimationEvaluationError, AnimationPlayer, Interpolation,
};
/// A value on a component that Bevy can animate. /// A value on a component that Bevy can animate.
/// ///

View file

@ -13,34 +13,33 @@ pub mod keyframes;
pub mod transition; pub mod transition;
mod util; mod util;
use std::any::{Any, TypeId}; use std::{
use std::cell::RefCell; any::{Any, TypeId},
use std::collections::BTreeMap; cell::RefCell,
use std::fmt::Debug; collections::BTreeMap,
use std::hash::{Hash, Hasher}; fmt::Debug,
use std::iter; hash::{Hash, Hasher},
iter,
};
use bevy_app::{App, Plugin, PostUpdate}; use bevy_app::{App, Plugin, PostUpdate};
use bevy_asset::{Asset, AssetApp, Assets, Handle}; use bevy_asset::{Asset, AssetApp, Assets, Handle};
use bevy_core::Name; use bevy_core::Name;
use bevy_ecs::entity::MapEntities; use bevy_ecs::{
use bevy_ecs::prelude::*; entity::MapEntities, prelude::*, reflect::ReflectMapEntities, world::EntityMutExcept,
use bevy_ecs::reflect::ReflectMapEntities; };
use bevy_ecs::world::EntityMutExcept;
use bevy_math::FloatExt; use bevy_math::FloatExt;
use bevy_reflect::utility::NonGenericTypeInfoCell;
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_reflect::{ use bevy_reflect::{
ApplyError, DynamicStruct, FieldIter, FromReflect, FromType, GetTypeRegistration, NamedField, prelude::ReflectDefault, utility::NonGenericTypeInfoCell, ApplyError, DynamicStruct, FieldIter,
PartialReflect, ReflectFromPtr, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, Struct, FromReflect, FromType, GetTypeRegistration, NamedField, PartialReflect, Reflect,
StructInfo, TypeInfo, TypePath, TypeRegistration, Typed, ReflectFromPtr, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, Struct, StructInfo,
TypeInfo, TypePath, TypeRegistration, Typed,
}; };
use bevy_time::Time; use bevy_time::Time;
use bevy_transform::prelude::Transform; use bevy_transform::{prelude::Transform, TransformSystem};
use bevy_transform::TransformSystem;
use bevy_ui::UiSystem; use bevy_ui::UiSystem;
use bevy_utils::hashbrown::HashMap;
use bevy_utils::{ use bevy_utils::{
hashbrown::HashMap,
tracing::{trace, warn}, tracing::{trace, warn},
NoOpHash, NoOpHash,
}; };

View file

@ -15,11 +15,9 @@ use bevy_utils::tracing::info_span;
use bevy_utils::{tracing::debug, HashMap}; use bevy_utils::{tracing::debug, HashMap};
use std::{ use std::{
fmt::Debug, fmt::Debug,
process::{ExitCode, Termination},
};
use std::{
num::NonZero, num::NonZero,
panic::{catch_unwind, resume_unwind, AssertUnwindSafe}, panic::{catch_unwind, resume_unwind, AssertUnwindSafe},
process::{ExitCode, Termination},
}; };
use thiserror::Error; use thiserror::Error;

View file

@ -78,6 +78,7 @@ pub struct First;
pub struct PreUpdate; pub struct PreUpdate;
/// Runs the [`FixedMain`] schedule in a loop according until all relevant elapsed time has been "consumed". /// Runs the [`FixedMain`] schedule in a loop according until all relevant elapsed time has been "consumed".
///
/// If you need to order your variable timestep systems /// If you need to order your variable timestep systems
/// before or after the fixed update logic, use the [`RunFixedMainLoopSystem`] system set. /// before or after the fixed update logic, use the [`RunFixedMainLoopSystem`] system set.
/// ///

View file

@ -6,8 +6,7 @@
//! For more fine-tuned control over panic behavior, disable the [`PanicHandlerPlugin`] or //! For more fine-tuned control over panic behavior, disable the [`PanicHandlerPlugin`] or
//! `DefaultPlugins` during app initialization. //! `DefaultPlugins` during app initialization.
use crate::App; use crate::{App, Plugin};
use crate::Plugin;
/// Adds sensible panic handlers to Apps. This plugin is part of the `DefaultPlugins`. Adding /// Adds sensible panic handlers to Apps. This plugin is part of the `DefaultPlugins`. Adding
/// this plugin will setup a panic hook appropriate to your target platform: /// this plugin will setup a panic hook appropriate to your target platform:

View file

@ -1,5 +1,8 @@
use crate::{App, AppError, Plugin}; use crate::{App, AppError, Plugin};
use bevy_utils::{tracing::debug, tracing::warn, TypeIdMap}; use bevy_utils::{
tracing::{debug, warn},
TypeIdMap,
};
use std::any::TypeId; use std::any::TypeId;
/// A macro for generating a well-documented [`PluginGroup`] from a list of [`Plugin`] paths. /// A macro for generating a well-documented [`PluginGroup`] from a list of [`Plugin`] paths.
@ -185,6 +188,7 @@ fn type_id_of_val<T: 'static>(_: &T) -> TypeId {
} }
/// Facilitates the creation and configuration of a [`PluginGroup`]. /// Facilitates the creation and configuration of a [`PluginGroup`].
///
/// Provides a build ordering to ensure that [`Plugin`]s which produce/require a [`Resource`](bevy_ecs::system::Resource) /// Provides a build ordering to ensure that [`Plugin`]s which produce/require a [`Resource`](bevy_ecs::system::Resource)
/// are built before/after dependent/depending [`Plugin`]s. [`Plugin`]s inside the group /// are built before/after dependent/depending [`Plugin`]s. [`Plugin`]s inside the group
/// can be disabled, enabled or reordered. /// can be disabled, enabled or reordered.

View file

@ -1,5 +1,7 @@
use crate::{self as bevy_asset}; use crate::{
use crate::{Asset, AssetEvent, AssetHandleProvider, AssetId, AssetServer, Handle, UntypedHandle}; self as bevy_asset, Asset, AssetEvent, AssetHandleProvider, AssetId, AssetServer, Handle,
UntypedHandle,
};
use bevy_ecs::{ use bevy_ecs::{
prelude::EventWriter, prelude::EventWriter,
system::{Res, ResMut, Resource}, system::{Res, ResMut, Resource},

View file

@ -303,6 +303,7 @@ impl PartialOrd for UntypedAssetId {
} }
/// An asset id without static or dynamic types associated with it. /// An asset id without static or dynamic types associated with it.
///
/// This exist to support efficient type erased id drop tracking. We /// This exist to support efficient type erased id drop tracking. We
/// could use [`UntypedAssetId`] for this, but the [`TypeId`] is unnecessary. /// could use [`UntypedAssetId`] for this, but the [`TypeId`] is unnecessary.
/// ///

View file

@ -3,8 +3,7 @@ use crate::io::{
memory::Dir, memory::Dir,
AssetSourceEvent, AssetWatcher, AssetSourceEvent, AssetWatcher,
}; };
use bevy_utils::tracing::warn; use bevy_utils::{tracing::warn, Duration, HashMap};
use bevy_utils::{Duration, HashMap};
use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, FileIdMap}; use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, FileIdMap};
use parking_lot::RwLock; use parking_lot::RwLock;
use std::{ use std::{

View file

@ -1,7 +1,8 @@
use crate::io::{AssetSourceEvent, AssetWatcher}; use crate::{
use crate::path::normalize_path; io::{AssetSourceEvent, AssetWatcher},
use bevy_utils::tracing::error; path::normalize_path,
use bevy_utils::Duration; };
use bevy_utils::{tracing::error, Duration};
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
use notify_debouncer_full::{ use notify_debouncer_full::{
new_debouncer, new_debouncer,

View file

@ -3,8 +3,8 @@ use bevy_utils::HashMap;
use futures_io::{AsyncRead, AsyncSeek}; use futures_io::{AsyncRead, AsyncSeek};
use futures_lite::{ready, Stream}; use futures_lite::{ready, Stream};
use parking_lot::RwLock; use parking_lot::RwLock;
use std::io::SeekFrom;
use std::{ use std::{
io::SeekFrom,
path::{Path, PathBuf}, path::{Path, PathBuf},
pin::Pin, pin::Pin,
sync::Arc, sync::Arc,

View file

@ -6,9 +6,7 @@ use crate::{
use async_lock::RwLockReadGuardArc; use async_lock::RwLockReadGuardArc;
use bevy_utils::tracing::trace; use bevy_utils::tracing::trace;
use futures_io::{AsyncRead, AsyncSeek}; use futures_io::{AsyncRead, AsyncSeek};
use std::io::SeekFrom; use std::{io::SeekFrom, path::Path, pin::Pin, sync::Arc, task::Poll};
use std::task::Poll;
use std::{path::Path, pin::Pin, sync::Arc};
use super::ErasedAssetReader; use super::ErasedAssetReader;

View file

@ -4,8 +4,10 @@ use crate::{
}; };
use atomicow::CowArc; use atomicow::CowArc;
use bevy_ecs::system::Resource; use bevy_ecs::system::Resource;
use bevy_utils::tracing::{error, warn}; use bevy_utils::{
use bevy_utils::{Duration, HashMap}; tracing::{error, warn},
Duration, HashMap,
};
use std::{fmt::Display, hash::Hash, sync::Arc}; use std::{fmt::Display, hash::Hash, sync::Arc};
use thiserror::Error; use thiserror::Error;

View file

@ -617,9 +617,9 @@ mod tests {
}; };
use bevy_app::{App, Update}; use bevy_app::{App, Update};
use bevy_core::TaskPoolPlugin; use bevy_core::TaskPoolPlugin;
use bevy_ecs::prelude::*;
use bevy_ecs::{ use bevy_ecs::{
event::EventCursor, event::EventCursor,
prelude::*,
schedule::{LogLevel, ScheduleBuildSettings}, schedule::{LogLevel, ScheduleBuildSettings},
}; };
use bevy_log::LogPlugin; use bevy_log::LogPlugin;

View file

@ -310,6 +310,7 @@ pub enum DeserializeMetaError {
} }
/// A context that provides access to assets in [`AssetLoader`]s, tracks dependencies, and collects asset load state. /// A context that provides access to assets in [`AssetLoader`]s, tracks dependencies, and collects asset load state.
///
/// Any asset state accessed by [`LoadContext`] will be tracked and stored for use in dependency events and asset preprocessing. /// Any asset state accessed by [`LoadContext`] will be tracked and stored for use in dependency events and asset preprocessing.
pub struct LoadContext<'a> { pub struct LoadContext<'a> {
pub(crate) asset_server: &'a AssetServer, pub(crate) asset_server: &'a AssetServer,

View file

@ -7,8 +7,7 @@ use crate::{
Asset, AssetLoadError, AssetPath, ErasedAssetLoader, ErasedLoadedAsset, Handle, LoadContext, Asset, AssetLoadError, AssetPath, ErasedAssetLoader, ErasedLoadedAsset, Handle, LoadContext,
LoadDirectError, LoadedAsset, LoadedUntypedAsset, LoadDirectError, LoadedAsset, LoadedUntypedAsset,
}; };
use std::any::TypeId; use std::{any::TypeId, sync::Arc};
use std::sync::Arc;
// Utility type for handling the sources of reader references // Utility type for handling the sources of reader references
enum ReaderRef<'a> { enum ReaderRef<'a> {

View file

@ -1,5 +1,7 @@
use crate::{self as bevy_asset, DeserializeMetaError, VisitAssetDependencies}; use crate::{
use crate::{loader::AssetLoader, processor::Process, Asset, AssetPath}; self as bevy_asset, loader::AssetLoader, processor::Process, Asset, AssetPath,
DeserializeMetaError, VisitAssetDependencies,
};
use bevy_utils::tracing::error; use bevy_utils::tracing::error;
use downcast_rs::{impl_downcast, Downcast}; use downcast_rs::{impl_downcast, Downcast};
use ron::ser::PrettyConfig; use ron::ser::PrettyConfig;

View file

@ -1,7 +1,6 @@
use crate::AssetPath; use crate::AssetPath;
use async_fs::File; use async_fs::File;
use bevy_utils::tracing::error; use bevy_utils::{tracing::error, HashSet};
use bevy_utils::HashSet;
use futures_lite::{AsyncReadExt, AsyncWriteExt}; use futures_lite::{AsyncReadExt, AsyncWriteExt};
use std::path::PathBuf; use std::path::PathBuf;
use thiserror::Error; use thiserror::Error;
@ -15,6 +14,7 @@ pub(crate) enum LogEntry {
} }
/// A "write ahead" logger that helps ensure asset importing is transactional. /// A "write ahead" logger that helps ensure asset importing is transactional.
///
/// Prior to processing an asset, we write to the log to indicate it has started /// Prior to processing an asset, we write to the log to indicate it has started
/// After processing an asset, we write to the log to indicate it has finished. /// After processing an asset, we write to the log to indicate it has finished.
/// On startup, the log can be read to determine if any transactions were incomplete. /// On startup, the log can be read to determine if any transactions were incomplete.

View file

@ -58,13 +58,15 @@ use crate::{
}; };
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_tasks::IoTaskPool; use bevy_tasks::IoTaskPool;
use bevy_utils::tracing::{debug, error, trace, warn}; use bevy_utils::{
tracing::{debug, error, trace, warn},
HashMap, HashSet,
};
#[cfg(feature = "trace")] #[cfg(feature = "trace")]
use bevy_utils::{ use bevy_utils::{
tracing::{info_span, instrument::Instrument}, tracing::{info_span, instrument::Instrument},
ConditionalSendFuture, ConditionalSendFuture,
}; };
use bevy_utils::{HashMap, HashSet};
use futures_io::ErrorKind; use futures_io::ErrorKind;
use futures_lite::{AsyncReadExt, AsyncWriteExt, StreamExt}; use futures_lite::{AsyncReadExt, AsyncWriteExt, StreamExt};
use parking_lot::RwLock; use parking_lot::RwLock;

View file

@ -1,14 +1,12 @@
use crate::io::SliceReader;
use crate::transformer::IdentityAssetTransformer;
use crate::{ use crate::{
io::{ io::{
AssetReaderError, AssetWriterError, MissingAssetWriterError, AssetReaderError, AssetWriterError, MissingAssetWriterError,
MissingProcessedAssetReaderError, MissingProcessedAssetWriterError, Writer, MissingProcessedAssetReaderError, MissingProcessedAssetWriterError, SliceReader, Writer,
}, },
meta::{AssetAction, AssetMeta, AssetMetaDyn, ProcessDependencyInfo, ProcessedInfo, Settings}, meta::{AssetAction, AssetMeta, AssetMetaDyn, ProcessDependencyInfo, ProcessedInfo, Settings},
processor::AssetProcessor, processor::AssetProcessor,
saver::{AssetSaver, SavedAsset}, saver::{AssetSaver, SavedAsset},
transformer::{AssetTransformer, TransformedAsset}, transformer::{AssetTransformer, IdentityAssetTransformer, TransformedAsset},
AssetLoadError, AssetLoader, AssetPath, DeserializeMetaError, ErasedLoadedAsset, AssetLoadError, AssetLoader, AssetPath, DeserializeMetaError, ErasedLoadedAsset,
MissingAssetLoaderForExtensionError, MissingAssetLoaderForTypeNameError, MissingAssetLoaderForExtensionError, MissingAssetLoaderForTypeNameError,
}; };

View file

@ -1,6 +1,7 @@
use crate::transformer::TransformedAsset; use crate::{
use crate::{io::Writer, meta::Settings, Asset, ErasedLoadedAsset}; io::Writer, meta::Settings, transformer::TransformedAsset, Asset, AssetLoader,
use crate::{AssetLoader, Handle, LabeledAsset, UntypedHandle}; ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle,
};
use atomicow::CowArc; use atomicow::CowArc;
use bevy_utils::{BoxedFuture, ConditionalSendFuture, HashMap}; use bevy_utils::{BoxedFuture, ConditionalSendFuture, HashMap};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -6,8 +6,7 @@ use crate::{
}; };
use bevy_ecs::world::World; use bevy_ecs::world::World;
use bevy_tasks::Task; use bevy_tasks::Task;
use bevy_utils::tracing::warn; use bevy_utils::{tracing::warn, Entry, HashMap, HashSet, TypeIdMap};
use bevy_utils::{Entry, HashMap, HashSet, TypeIdMap};
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
use std::{ use std::{
any::TypeId, any::TypeId,

View file

@ -4,13 +4,15 @@ use crate::{
}; };
use async_broadcast::RecvError; use async_broadcast::RecvError;
use bevy_tasks::IoTaskPool; use bevy_tasks::IoTaskPool;
use bevy_utils::tracing::{error, warn}; use bevy_utils::{
tracing::{error, warn},
HashMap, TypeIdMap,
};
#[cfg(feature = "trace")] #[cfg(feature = "trace")]
use bevy_utils::{ use bevy_utils::{
tracing::{info_span, instrument::Instrument}, tracing::{info_span, instrument::Instrument},
ConditionalSendFuture, ConditionalSendFuture,
}; };
use bevy_utils::{HashMap, TypeIdMap};
use std::{any::TypeId, sync::Arc}; use std::{any::TypeId, sync::Arc};
use thiserror::Error; use thiserror::Error;

View file

@ -20,16 +20,22 @@ use crate::{
use atomicow::CowArc; use atomicow::CowArc;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_tasks::IoTaskPool; use bevy_tasks::IoTaskPool;
use bevy_utils::tracing::{error, info}; use bevy_utils::{
use bevy_utils::HashSet; tracing::{error, info},
HashSet,
};
use crossbeam_channel::{Receiver, Sender}; use crossbeam_channel::{Receiver, Sender};
use futures_lite::{FutureExt, StreamExt}; use futures_lite::{FutureExt, StreamExt};
use info::*; use info::*;
use loaders::*; use loaders::*;
use parking_lot::RwLock; use parking_lot::RwLock;
use std::{any::Any, path::PathBuf}; use std::{
use std::{any::TypeId, path::Path, sync::Arc}; any::{Any, TypeId},
use std::{future::Future, panic::AssertUnwindSafe}; future::Future,
panic::AssertUnwindSafe,
path::{Path, PathBuf},
sync::Arc,
};
use thiserror::Error; use thiserror::Error;
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader). This can be used to kick off new asset loads and /// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader). This can be used to kick off new asset loads and

View file

@ -44,6 +44,7 @@ pub enum PlaybackMode {
} }
/// Initial settings to be used when audio starts playing. /// Initial settings to be used when audio starts playing.
///
/// If you would like to control the audio while it is playing, query for the /// If you would like to control the audio while it is playing, query for the
/// [`AudioSink`][crate::AudioSink] or [`SpatialAudioSink`][crate::SpatialAudioSink] /// [`AudioSink`][crate::AudioSink] or [`SpatialAudioSink`][crate::SpatialAudioSink]
/// components. Changes to this component will *not* be applied to already-playing audio. /// components. Changes to this component will *not* be applied to already-playing audio.

View file

@ -73,6 +73,7 @@ impl AssetLoader for AudioLoader {
} }
/// A type implementing this trait can be converted to a [`rodio::Source`] type. /// A type implementing this trait can be converted to a [`rodio::Source`] type.
///
/// It must be [`Send`] and [`Sync`] in order to be registered. /// It must be [`Send`] and [`Sync`] in order to be registered.
/// Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples. /// Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples.
/// This trait is implemented for [`AudioSource`]. /// This trait is implemented for [`AudioSource`].

View file

@ -48,9 +48,7 @@ pub use audio::*;
pub use audio_source::*; pub use audio_source::*;
pub use pitch::*; pub use pitch::*;
pub use rodio::cpal::Sample as CpalSample; pub use rodio::{cpal::Sample as CpalSample, source::Source, Sample};
pub use rodio::source::Source;
pub use rodio::Sample;
pub use sinks::*; pub use sinks::*;
use bevy_app::prelude::*; use bevy_app::prelude::*;

View file

@ -1,7 +1,10 @@
use crate::{AudioSourceBundle, Decodable}; use crate::{AudioSourceBundle, Decodable};
use bevy_asset::Asset; use bevy_asset::Asset;
use bevy_reflect::TypePath; use bevy_reflect::TypePath;
use rodio::{source::SineWave, source::TakeDuration, Source}; use rodio::{
source::{SineWave, TakeDuration},
Source,
};
/// A source of sine wave sound /// A source of sine wave sound
#[derive(Asset, Debug, Clone, TypePath)] #[derive(Asset, Debug, Clone, TypePath)]

View file

@ -66,8 +66,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::palettes::basic; use crate::{palettes::basic, Srgba};
use crate::Srgba;
#[test] #[test]
fn test_color_curve() { fn test_color_curve() {

View file

@ -22,8 +22,7 @@ impl<T: Mix> ColorRange<T> for Range<T> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::palettes::basic; use crate::{palettes::basic, LinearRgba, Srgba};
use crate::{LinearRgba, Srgba};
#[test] #[test]
fn test_color_range() { fn test_color_range() {

View file

@ -57,7 +57,6 @@
//! a form of chromaticity, while `y` defines an illuminance level. //! a form of chromaticity, while `y` defines an illuminance level.
//! //!
//! See also the [Wikipedia article on color spaces](https://en.wikipedia.org/wiki/Color_space). //! See also the [Wikipedia article on color spaces](https://en.wikipedia.org/wiki/Color_space).
//!
#![doc = include_str!("../docs/conversion.md")] #![doc = include_str!("../docs/conversion.md")]
//! <div> //! <div>
#![doc = include_str!("../docs/diagrams/model_graph.svg")] #![doc = include_str!("../docs/diagrams/model_graph.svg")]
@ -115,18 +114,10 @@ mod xyza;
/// ///
/// This includes the most common types in this crate, re-exported for your convenience. /// This includes the most common types in this crate, re-exported for your convenience.
pub mod prelude { pub mod prelude {
pub use crate::color::*; pub use crate::{
pub use crate::color_ops::*; color::*, color_ops::*, hsla::*, hsva::*, hwba::*, laba::*, lcha::*, linear_rgba::*,
pub use crate::hsla::*; oklaba::*, oklcha::*, srgba::*, xyza::*,
pub use crate::hsva::*; };
pub use crate::hwba::*;
pub use crate::laba::*;
pub use crate::lcha::*;
pub use crate::linear_rgba::*;
pub use crate::oklaba::*;
pub use crate::oklcha::*;
pub use crate::srgba::*;
pub use crate::xyza::*;
} }
pub use color::*; pub use color::*;

View file

@ -3,29 +3,27 @@
//! //!
//! Generated from Tailwind 3.4.1. //! Generated from Tailwind 3.4.1.
/* // MIT License
MIT License //
// Copyright (c) Tailwind Labs, Inc.
Copyright (c) Tailwind Labs, Inc. //
// Permission is hereby granted, free of charge, to any person obtaining a copy
Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal
of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights
in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is
copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions:
furnished to do so, subject to the following conditions: //
// The above copyright notice and this permission notice shall be included in all
The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software.
copies or substantial portions of the Software. //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE.
SOFTWARE.
*/
use crate::Srgba; use crate::Srgba;

View file

@ -1,7 +1,6 @@
use crate::color_difference::EuclideanDistance;
use crate::{ use crate::{
impl_componentwise_vector_space, Alpha, ColorToComponents, ColorToPacked, Gray, LinearRgba, color_difference::EuclideanDistance, impl_componentwise_vector_space, Alpha, ColorToComponents,
Luminance, Mix, StandardColor, Xyza, ColorToPacked, Gray, LinearRgba, Luminance, Mix, StandardColor, Xyza,
}; };
use bevy_math::{ops, Vec3, Vec4}; use bevy_math::{ops, Vec3, Vec4};
#[cfg(feature = "bevy_reflect")] #[cfg(feature = "bevy_reflect")]
@ -185,7 +184,6 @@ impl Srgba {
/// * `b` - Blue channel. [0, 255] /// * `b` - Blue channel. [0, 255]
/// ///
/// See also [`Srgba::new`], [`Srgba::rgba_u8`], [`Srgba::hex`]. /// See also [`Srgba::new`], [`Srgba::rgba_u8`], [`Srgba::hex`].
///
pub fn rgb_u8(r: u8, g: u8, b: u8) -> Self { pub fn rgb_u8(r: u8, g: u8, b: u8) -> Self {
Self::from_u8_array_no_alpha([r, g, b]) Self::from_u8_array_no_alpha([r, g, b])
} }
@ -202,7 +200,6 @@ impl Srgba {
/// * `a` - Alpha channel. [0, 255] /// * `a` - Alpha channel. [0, 255]
/// ///
/// See also [`Srgba::new`], [`Srgba::rgb_u8`], [`Srgba::hex`]. /// See also [`Srgba::new`], [`Srgba::rgb_u8`], [`Srgba::hex`].
///
pub fn rgba_u8(r: u8, g: u8, b: u8, a: u8) -> Self { pub fn rgba_u8(r: u8, g: u8, b: u8, a: u8) -> Self {
Self::from_u8_array([r, g, b, a]) Self::from_u8_array([r, g, b, a])
} }

View file

@ -1,7 +1,6 @@
use bevy_ecs::query::QueryData;
#[cfg(feature = "bevy_reflect")] #[cfg(feature = "bevy_reflect")]
use bevy_ecs::reflect::ReflectComponent; use bevy_ecs::reflect::ReflectComponent;
use bevy_ecs::{component::Component, entity::Entity}; use bevy_ecs::{component::Component, entity::Entity, query::QueryData};
#[cfg(feature = "bevy_reflect")] #[cfg(feature = "bevy_reflect")]
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::std_traits::ReflectDefault;
@ -141,7 +140,7 @@ impl<'a> std::fmt::Display for NameOrEntityItem<'a> {
} }
} }
/* Conversions from strings */ // Conversions from strings
impl From<&str> for Name { impl From<&str> for Name {
#[inline(always)] #[inline(always)]
@ -156,7 +155,7 @@ impl From<String> for Name {
} }
} }
/* Conversions to strings */ // Conversions to strings
impl AsRef<str> for Name { impl AsRef<str> for Name {
#[inline(always)] #[inline(always)]

View file

@ -8,8 +8,7 @@ use serde::{
Deserialize, Deserializer, Serialize, Serializer, Deserialize, Deserializer, Serialize, Serializer,
}; };
use super::name::Name; use super::{name::Name, FrameCount};
use super::FrameCount;
impl Serialize for Name { impl Serialize for Name {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {

View file

@ -6,8 +6,7 @@ use bevy_render::{
}; };
use bevy_utils::{Entry, HashMap}; use bevy_utils::{Entry, HashMap};
use super::pipeline::AutoExposureUniform; use super::{pipeline::AutoExposureUniform, AutoExposure};
use super::AutoExposure;
#[derive(Resource, Default)] #[derive(Resource, Default)]
pub(super) struct AutoExposureBuffers { pub(super) struct AutoExposureBuffers {

View file

@ -1,17 +1,15 @@
use bevy_app::prelude::*; use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, AssetApp, Assets, Handle}; use bevy_asset::{load_internal_asset, AssetApp, Assets, Handle};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_render::extract_component::ExtractComponentPlugin;
use bevy_render::render_asset::RenderAssetPlugin;
use bevy_render::render_resource::Shader;
use bevy_render::ExtractSchedule;
use bevy_render::{ use bevy_render::{
extract_component::ExtractComponentPlugin,
render_asset::RenderAssetPlugin,
render_graph::RenderGraphApp, render_graph::RenderGraphApp,
render_resource::{ render_resource::{
Buffer, BufferDescriptor, BufferUsages, PipelineCache, SpecializedComputePipelines, Buffer, BufferDescriptor, BufferUsages, PipelineCache, Shader, SpecializedComputePipelines,
}, },
renderer::RenderDevice, renderer::RenderDevice,
Render, RenderApp, RenderSet, ExtractSchedule, Render, RenderApp, RenderSet,
}; };
mod buffers; mod buffers;
@ -29,8 +27,10 @@ use pipeline::{
#[allow(deprecated)] #[allow(deprecated)]
pub use settings::{AutoExposure, AutoExposureSettings}; pub use settings::{AutoExposure, AutoExposureSettings};
use crate::auto_exposure::compensation_curve::GpuAutoExposureCompensationCurve; use crate::{
use crate::core_3d::graph::{Core3d, Node3d}; auto_exposure::compensation_curve::GpuAutoExposureCompensationCurve,
core_3d::graph::{Core3d, Node3d},
};
/// Plugin for the auto exposure feature. /// Plugin for the auto exposure feature.
/// ///

View file

@ -3,8 +3,7 @@ use std::ops::RangeInclusive;
use super::compensation_curve::AutoExposureCompensationCurve; use super::compensation_curve::AutoExposureCompensationCurve;
use bevy_asset::Handle; use bevy_asset::Handle;
use bevy_ecs::{prelude::Component, reflect::ReflectComponent}; use bevy_ecs::{prelude::Component, reflect::ReflectComponent};
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect;
use bevy_render::{extract_component::ExtractComponent, texture::Image}; use bevy_render::{extract_component::ExtractComponent, texture::Image};
use bevy_utils::default; use bevy_utils::default;
@ -23,7 +22,6 @@ use bevy_utils::default;
/// # Usage Notes /// # Usage Notes
/// ///
/// **Auto Exposure requires compute shaders and is not compatible with WebGL2.** /// **Auto Exposure requires compute shaders and is not compatible with WebGL2.**
///
#[derive(Component, Clone, Reflect, ExtractComponent)] #[derive(Component, Clone, Reflect, ExtractComponent)]
#[reflect(Component, Default)] #[reflect(Component, Default)]
pub struct AutoExposure { pub struct AutoExposure {

View file

@ -6,8 +6,7 @@ use crate::{
use bevy_app::prelude::*; use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, Handle}; use bevy_asset::{load_internal_asset, Handle};
use bevy_ecs::{prelude::*, query::QueryItem}; use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect;
use bevy_render::{ use bevy_render::{
extract_component::{ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin}, extract_component::{ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin},
prelude::Camera, prelude::Camera,

View file

@ -1,15 +1,16 @@
use crate::core_2d::graph::Core2d; use crate::{
use crate::tonemapping::{DebandDither, Tonemapping}; core_2d::graph::Core2d,
tonemapping::{DebandDither, Tonemapping},
};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect;
use bevy_render::prelude::Msaa;
use bevy_render::{ use bevy_render::{
camera::{ camera::{
Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph, Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph,
OrthographicProjection, OrthographicProjection,
}, },
extract_component::ExtractComponent, extract_component::ExtractComponent,
prelude::Msaa,
primitives::Frustum, primitives::Frustum,
view::VisibleEntities, view::VisibleEntities,
}; };

View file

@ -3,15 +3,13 @@ use crate::{
tonemapping::{DebandDither, Tonemapping}, tonemapping::{DebandDither, Tonemapping},
}; };
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect, ReflectDeserialize, ReflectSerialize};
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
use bevy_render::view::Msaa;
use bevy_render::{ use bevy_render::{
camera::{Camera, CameraMainTextureUsages, CameraRenderGraph, Exposure, Projection}, camera::{Camera, CameraMainTextureUsages, CameraRenderGraph, Exposure, Projection},
extract_component::ExtractComponent, extract_component::ExtractComponent,
primitives::Frustum, primitives::Frustum,
render_resource::{LoadOp, TextureUsages}, render_resource::{LoadOp, TextureUsages},
view::{ColorGrading, VisibleEntities}, view::{ColorGrading, Msaa, VisibleEntities},
}; };
use bevy_transform::prelude::{GlobalTransform, Transform}; use bevy_transform::prelude::{GlobalTransform, Transform};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -1,13 +1,11 @@
use bevy_ecs::prelude::*; use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_ecs::query::QueryItem;
use bevy_render::render_graph::ViewNode; use bevy_render::render_graph::ViewNode;
use bevy_render::render_phase::{TrackedRenderPass, ViewBinnedRenderPhases};
use bevy_render::render_resource::{CommandEncoderDescriptor, StoreOp};
use bevy_render::{ use bevy_render::{
camera::ExtractedCamera, camera::ExtractedCamera,
render_graph::{NodeRunError, RenderGraphContext}, render_graph::{NodeRunError, RenderGraphContext},
render_resource::RenderPassDescriptor, render_phase::{TrackedRenderPass, ViewBinnedRenderPhases},
render_resource::{CommandEncoderDescriptor, RenderPassDescriptor, StoreOp},
renderer::RenderContext, renderer::RenderContext,
view::ViewDepthTexture, view::ViewDepthTexture,
}; };

View file

@ -10,8 +10,7 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::{ use bevy_render::{
extract_component::{ExtractComponent, ExtractComponentPlugin}, extract_component::{ExtractComponent, ExtractComponentPlugin},
prelude::Camera, prelude::Camera,
render_graph::RenderGraphApp, render_graph::{RenderGraphApp, ViewNodeRunner},
render_graph::ViewNodeRunner,
render_resource::{ render_resource::{
binding_types::{sampler, texture_2d}, binding_types::{sampler, texture_2d},
*, *,

View file

@ -1,8 +1,7 @@
use std::sync::Mutex; use std::sync::Mutex;
use crate::fxaa::{CameraFxaaPipeline, Fxaa, FxaaPipeline}; use crate::fxaa::{CameraFxaaPipeline, Fxaa, FxaaPipeline};
use bevy_ecs::prelude::*; use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_ecs::query::QueryItem;
use bevy_render::{ use bevy_render::{
render_graph::{NodeRunError, RenderGraphContext, ViewNode}, render_graph::{NodeRunError, RenderGraphContext, ViewNode},
render_resource::{ render_resource::{

View file

@ -5,17 +5,15 @@ use crate::{
}; };
use bevy_app::{App, Plugin}; use bevy_app::{App, Plugin};
use bevy_color::LinearRgba; use bevy_color::LinearRgba;
use bevy_ecs::prelude::*; use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_ecs::query::QueryItem;
use bevy_render::render_graph::{ViewNode, ViewNodeRunner};
use bevy_render::{ use bevy_render::{
camera::ExtractedCamera, camera::ExtractedCamera,
render_graph::{NodeRunError, RenderGraphApp, RenderGraphContext}, render_graph::{NodeRunError, RenderGraphApp, RenderGraphContext, ViewNode, ViewNodeRunner},
render_resource::*,
renderer::RenderContext, renderer::RenderContext,
view::{Msaa, ViewTarget}, view::{Msaa, ViewTarget},
Render, RenderSet, Render, RenderApp, RenderSet,
}; };
use bevy_render::{render_resource::*, RenderApp};
/// This enables "msaa writeback" support for the `core_2d` and `core_3d` pipelines, which can be enabled on cameras /// This enables "msaa writeback" support for the `core_2d` and `core_3d` pipelines, which can be enabled on cameras
/// using [`bevy_render::camera::Camera::msaa_writeback`]. See the docs on that field for more information. /// using [`bevy_render::camera::Camera::msaa_writeback`]. See the docs on that field for more information.

View file

@ -32,8 +32,7 @@ use std::ops::Range;
use bevy_asset::UntypedAssetId; use bevy_asset::UntypedAssetId;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_math::Mat4; use bevy_math::Mat4;
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect;
use bevy_render::{ use bevy_render::{
render_phase::{ render_phase::{
BinnedPhaseItem, CachedRenderPipelinePhaseItem, DrawFunctionId, PhaseItem, BinnedPhaseItem, CachedRenderPipelinePhaseItem, DrawFunctionId, PhaseItem,

View file

@ -1,5 +1,4 @@
use bevy_ecs::prelude::*; use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_ecs::query::QueryItem;
use bevy_render::{ use bevy_render::{
camera::ExtractedCamera, camera::ExtractedCamera,
diagnostic::RecordDiagnostics, diagnostic::RecordDiagnostics,

View file

@ -15,8 +15,7 @@ use bevy_ecs::{
world::{FromWorld, World}, world::{FromWorld, World},
}; };
use bevy_math::vec2; use bevy_math::vec2;
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect;
use bevy_render::{ use bevy_render::{
camera::{ExtractedCamera, MipBias, TemporalJitter}, camera::{ExtractedCamera, MipBias, TemporalJitter},
prelude::{Camera, Projection}, prelude::{Camera, Projection},

View file

@ -2,19 +2,21 @@ use crate::fullscreen_vertex_shader::fullscreen_shader_vertex_state;
use bevy_app::prelude::*; use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, Assets, Handle}; use bevy_asset::{load_internal_asset, Assets, Handle};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_reflect::std_traits::ReflectDefault; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_reflect::Reflect; use bevy_render::{
use bevy_render::extract_component::{ExtractComponent, ExtractComponentPlugin}; camera::Camera,
use bevy_render::extract_resource::{ExtractResource, ExtractResourcePlugin}; extract_component::{ExtractComponent, ExtractComponentPlugin},
use bevy_render::render_asset::{RenderAssetUsages, RenderAssets}; extract_resource::{ExtractResource, ExtractResourcePlugin},
use bevy_render::render_resource::binding_types::{ render_asset::{RenderAssetUsages, RenderAssets},
sampler, texture_2d, texture_3d, uniform_buffer, render_resource::{
binding_types::{sampler, texture_2d, texture_3d, uniform_buffer},
*,
},
renderer::RenderDevice,
texture::{CompressedImageFormats, FallbackImage, GpuImage, Image, ImageSampler, ImageType},
view::{ExtractedView, ViewTarget, ViewUniform},
Render, RenderApp, RenderSet,
}; };
use bevy_render::renderer::RenderDevice;
use bevy_render::texture::{CompressedImageFormats, GpuImage, Image, ImageSampler, ImageType};
use bevy_render::view::{ExtractedView, ViewTarget, ViewUniform};
use bevy_render::{camera::Camera, texture::FallbackImage};
use bevy_render::{render_resource::*, Render, RenderApp, RenderSet};
#[cfg(not(feature = "tonemapping_luts"))] #[cfg(not(feature = "tonemapping_luts"))]
use bevy_utils::tracing::error; use bevy_utils::tracing::error;
use bitflags::bitflags; use bitflags::bitflags;

View file

@ -1,9 +1,12 @@
use crate::blit::{BlitPipeline, BlitPipelineKey}; use crate::blit::{BlitPipeline, BlitPipelineKey};
use bevy_app::prelude::*; use bevy_app::prelude::*;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_render::camera::{CameraOutputMode, ExtractedCamera}; use bevy_render::{
use bevy_render::view::ViewTarget; camera::{CameraOutputMode, ExtractedCamera},
use bevy_render::{render_resource::*, Render, RenderApp, RenderSet}; render_resource::*,
view::ViewTarget,
Render, RenderApp, RenderSet,
};
use bevy_utils::HashSet; use bevy_utils::HashSet;
mod node; mod node;

View file

@ -1,8 +1,7 @@
use crate::{blit::BlitPipeline, upscaling::ViewUpscalingPipeline}; use crate::{blit::BlitPipeline, upscaling::ViewUpscalingPipeline};
use bevy_ecs::{prelude::*, query::QueryItem}; use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_render::camera::{ClearColor, ClearColorConfig};
use bevy_render::{ use bevy_render::{
camera::{CameraOutputMode, ExtractedCamera}, camera::{CameraOutputMode, ClearColor, ClearColorConfig, ExtractedCamera},
render_graph::{NodeRunError, RenderGraphContext, ViewNode}, render_graph::{NodeRunError, RenderGraphContext, ViewNode},
render_resource::{ render_resource::{
BindGroup, BindGroupEntries, PipelineCache, RenderPassDescriptor, TextureViewId, BindGroup, BindGroupEntries, PipelineCache, RenderPassDescriptor, TextureViewId,

View file

@ -1,5 +1,8 @@
use std::hash::{Hash, Hasher}; use std::{
use std::{borrow::Cow, collections::VecDeque}; borrow::Cow,
collections::VecDeque,
hash::{Hash, Hasher},
};
use bevy_app::{App, SubApp}; use bevy_app::{App, SubApp};
use bevy_ecs::system::{Deferred, Res, Resource, SystemBuffer, SystemParam}; use bevy_ecs::system::{Deferred, Res, Resource, SystemBuffer, SystemParam};

View file

@ -2,8 +2,10 @@ use super::{Diagnostic, DiagnosticPath, DiagnosticsStore};
use bevy_app::prelude::*; use bevy_app::prelude::*;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_time::{Real, Time, Timer, TimerMode}; use bevy_time::{Real, Time, Timer, TimerMode};
use bevy_utils::tracing::{debug, info}; use bevy_utils::{
use bevy_utils::Duration; tracing::{debug, info},
Duration,
};
/// An App Plugin that logs diagnostics to the console. /// An App Plugin that logs diagnostics to the console.
/// ///

View file

@ -90,7 +90,6 @@ impl BatchingStrategy {
/// # Panics /// # Panics
/// ///
/// Panics if `thread_count` is 0. /// Panics if `thread_count` is 0.
///
#[inline] #[inline]
pub fn calc_batch_size(&self, max_items: impl FnOnce() -> usize, thread_count: usize) -> usize { pub fn calc_batch_size(&self, max_items: impl FnOnce() -> usize, thread_count: usize) -> usize {
if self.batch_size_limits.is_empty() { if self.batch_size_limits.is_empty() {

View file

@ -1446,9 +1446,7 @@ fn initialize_dynamic_bundle(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::component::ComponentId; use crate::{component::ComponentId, prelude::*, world::DeferredWorld};
use crate::prelude::*;
use crate::world::DeferredWorld;
#[derive(Component)] #[derive(Component)]
struct A; struct A;

View file

@ -8,10 +8,12 @@ use crate::{
#[cfg(feature = "track_change_detection")] #[cfg(feature = "track_change_detection")]
use bevy_ptr::ThinSlicePtr; use bevy_ptr::ThinSlicePtr;
use bevy_ptr::{Ptr, UnsafeCellDeref}; use bevy_ptr::{Ptr, UnsafeCellDeref};
use std::mem;
use std::ops::{Deref, DerefMut};
#[cfg(feature = "track_change_detection")] #[cfg(feature = "track_change_detection")]
use std::{cell::UnsafeCell, panic::Location}; use std::{cell::UnsafeCell, panic::Location};
use std::{
mem,
ops::{Deref, DerefMut},
};
/// The (arbitrarily chosen) minimum number of world tick increments between `check_tick` scans. /// The (arbitrarily chosen) minimum number of world tick increments between `check_tick` scans.
/// ///
@ -102,7 +104,6 @@ pub trait DetectChanges {
/// resource.0 = 42; // triggers change detection via [`DerefMut`] /// resource.0 = 42; // triggers change detection via [`DerefMut`]
/// } /// }
/// ``` /// ```
///
pub trait DetectChangesMut: DetectChanges { pub trait DetectChangesMut: DetectChanges {
/// The type contained within this smart pointer /// The type contained within this smart pointer
/// ///

View file

@ -21,11 +21,12 @@ use std::{
alloc::Layout, alloc::Layout,
any::{Any, TypeId}, any::{Any, TypeId},
borrow::Cow, borrow::Cow,
cell::UnsafeCell,
fmt::Debug,
marker::PhantomData, marker::PhantomData,
mem::needs_drop, mem::needs_drop,
sync::Arc, sync::Arc,
}; };
use std::{cell::UnsafeCell, fmt::Debug};
/// A data type that can be used to store data for an [entity]. /// A data type that can be used to store data for an [entity].
/// ///
@ -266,7 +267,6 @@ use std::{cell::UnsafeCell, fmt::Debug};
/// fn my_on_insert_hook<T1, T2>(world: DeferredWorld, _: T1, _: T2) { /// fn my_on_insert_hook<T1, T2>(world: DeferredWorld, _: T1, _: T2) {
/// // ... /// // ...
/// } /// }
///
/// ``` /// ```
/// ///
/// # Implementing the trait for foreign types /// # Implementing the trait for foreign types

View file

@ -221,9 +221,8 @@ impl<'m> SceneEntityMapper<'m> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::entity::DynEntityMapper;
use crate::{ use crate::{
entity::{Entity, EntityHashMap, EntityMapper, SceneEntityMapper}, entity::{DynEntityMapper, Entity, EntityHashMap, EntityMapper, SceneEntityMapper},
world::World, world::World,
}; };
use bevy_utils::assert_object_safe; use bevy_utils::assert_object_safe;

View file

@ -8,8 +8,10 @@ use bevy_ecs::{
#[cfg(feature = "bevy_reflect")] #[cfg(feature = "bevy_reflect")]
use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_utils::detailed_trace; use bevy_utils::detailed_trace;
use std::marker::PhantomData; use std::{
use std::ops::{Deref, DerefMut}; marker::PhantomData,
ops::{Deref, DerefMut},
};
/// An event collection that represents the events that occurred within the last two /// An event collection that represents the events that occurred within the last two
/// [`Events::update`] calls. /// [`Events::update`] calls.

View file

@ -96,7 +96,6 @@ impl<'w, 's, E: Event> EventMutator<'w, 's, E> {
/// // all events were processed /// // all events were processed
/// assert_eq!(counter.into_inner(), 4950); /// assert_eq!(counter.into_inner(), 4950);
/// ``` /// ```
///
#[cfg(feature = "multi_threaded")] #[cfg(feature = "multi_threaded")]
pub fn par_read(&mut self) -> EventMutParIter<'_, E> { pub fn par_read(&mut self) -> EventMutParIter<'_, E> {
self.reader.par_read_mut(&mut self.events) self.reader.par_read_mut(&mut self.events)

View file

@ -68,7 +68,6 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> {
/// // all events were processed /// // all events were processed
/// assert_eq!(counter.into_inner(), 4950); /// assert_eq!(counter.into_inner(), 4950);
/// ``` /// ```
///
#[cfg(feature = "multi_threaded")] #[cfg(feature = "multi_threaded")]
pub fn par_read(&mut self) -> EventParIter<'_, E> { pub fn par_read(&mut self) -> EventParIter<'_, E> {
self.reader.par_read(&self.events) self.reader.par_read(&self.events)

View file

@ -14,6 +14,7 @@ pub(crate) mod kinds;
pub(crate) mod masks; pub(crate) mod masks;
/// A unified identifier for all entity and similar IDs. /// A unified identifier for all entity and similar IDs.
///
/// Has the same size as a `u64` integer, but the layout is split between a 32-bit low /// Has the same size as a `u64` integer, but the layout is split between a 32-bit low
/// segment, a 31-bit high segment, and the significant bit reserved as type flags to denote /// segment, a 31-bit high segment, and the significant bit reserved as type flags to denote
/// entity kinds. /// entity kinds.

View file

@ -24,7 +24,6 @@ use bevy_utils::HashSet;
/// Two interned values are only guaranteed to compare equal if they were interned using /// Two interned values are only guaranteed to compare equal if they were interned using
/// the same [`Interner`] instance. /// the same [`Interner`] instance.
// NOTE: This type must NEVER implement Borrow since it does not obey that trait's invariants. // NOTE: This type must NEVER implement Borrow since it does not obey that trait's invariants.
///
/// ``` /// ```
/// # use bevy_ecs::intern::*; /// # use bevy_ecs::intern::*;
/// #[derive(PartialEq, Eq, Hash, Debug)] /// #[derive(PartialEq, Eq, Hash, Debug)]

View file

@ -77,23 +77,22 @@ pub mod prelude {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::prelude::Or;
use crate::world::EntityMut;
use crate::{ use crate::{
bundle::Bundle, bundle::Bundle,
change_detection::Ref, change_detection::Ref,
component::{Component, ComponentId}, component::{Component, ComponentId},
entity::Entity, entity::Entity,
prelude::Or,
query::{Added, Changed, FilteredAccess, QueryFilter, With, Without}, query::{Added, Changed, FilteredAccess, QueryFilter, With, Without},
system::Resource, system::Resource,
world::{EntityRef, Mut, World}, world::{EntityMut, EntityRef, Mut, World},
}; };
use bevy_tasks::{ComputeTaskPool, TaskPool}; use bevy_tasks::{ComputeTaskPool, TaskPool};
use bevy_utils::HashSet; use bevy_utils::HashSet;
use std::num::NonZero;
use std::{ use std::{
any::TypeId, any::TypeId,
marker::PhantomData, marker::PhantomData,
num::NonZero,
sync::{ sync::{
atomic::{AtomicUsize, Ordering}, atomic::{AtomicUsize, Ordering},
Arc, Mutex, Arc, Mutex,

View file

@ -7,14 +7,22 @@ mod trigger_event;
pub use runner::*; pub use runner::*;
pub use trigger_event::*; pub use trigger_event::*;
use crate::entity::EntityHashMap; use crate::{
use crate::observer::entity_observer::ObservedBy; archetype::ArchetypeFlags,
use crate::{archetype::ArchetypeFlags, system::IntoObserverSystem, world::*}; component::ComponentId,
use crate::{component::ComponentId, prelude::*, world::DeferredWorld}; entity::EntityHashMap,
observer::entity_observer::ObservedBy,
prelude::*,
system::IntoObserverSystem,
world::{DeferredWorld, *},
};
use bevy_ptr::Ptr; use bevy_ptr::Ptr;
use bevy_utils::HashMap; use bevy_utils::HashMap;
use std::ops::{Deref, DerefMut}; use std::{
use std::{fmt::Debug, marker::PhantomData}; fmt::Debug,
marker::PhantomData,
ops::{Deref, DerefMut},
};
/// Type containing triggered [`Event`] information for a given run of an [`Observer`]. This contains the /// Type containing triggered [`Event`] information for a given run of an [`Observer`]. This contains the
/// [`Event`] data itself. If it was triggered for a specific [`Entity`], it includes that as well. It also /// [`Event`] data itself. If it was triggered for a specific [`Entity`], it includes that as well. It also
@ -525,11 +533,11 @@ mod tests {
use bevy_ptr::OwningPtr; use bevy_ptr::OwningPtr;
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::observer::{ use crate::{
EmitDynamicTrigger, Observer, ObserverDescriptor, ObserverState, OnReplace, observer::{EmitDynamicTrigger, Observer, ObserverDescriptor, ObserverState, OnReplace},
prelude::*,
traversal::Traversal,
}; };
use crate::prelude::*;
use crate::traversal::Traversal;
#[derive(Component)] #[derive(Component)]
struct A; struct A;

View file

@ -86,6 +86,7 @@ impl Component for ObserverState {
} }
/// Type for function that is run when an observer is triggered. /// Type for function that is run when an observer is triggered.
///
/// Typically refers to the default runner that runs the system stored in the associated [`Observer`] component, /// Typically refers to the default runner that runs the system stored in the associated [`Observer`] component,
/// but can be overridden for custom behaviour. /// but can be overridden for custom behaviour.
pub type ObserverRunner = fn(DeferredWorld, ObserverTrigger, PtrMut, propagate: &mut bool); pub type ObserverRunner = fn(DeferredWorld, ObserverTrigger, PtrMut, propagate: &mut bool);

View file

@ -100,6 +100,7 @@ fn trigger_event<E: Event, Targets: TriggerTargets>(
} }
/// Represents a collection of targets for a specific [`Trigger`] of an [`Event`]. Targets can be of type [`Entity`] or [`ComponentId`]. /// Represents a collection of targets for a specific [`Trigger`] of an [`Event`]. Targets can be of type [`Entity`] or [`ComponentId`].
///
/// When a trigger occurs for a given event and [`TriggerTargets`], any [`Observer`] that watches for that specific event-target combination /// When a trigger occurs for a given event and [`TriggerTargets`], any [`Observer`] that watches for that specific event-target combination
/// will run. /// will run.
/// ///

View file

@ -1,8 +1,7 @@
use crate::storage::SparseSetIndex; use crate::storage::SparseSetIndex;
use core::fmt; use core::fmt;
use fixedbitset::FixedBitSet; use fixedbitset::FixedBitSet;
use std::fmt::Debug; use std::{fmt::Debug, marker::PhantomData};
use std::marker::PhantomData;
/// A wrapper struct to make Debug representations of [`FixedBitSet`] easier /// A wrapper struct to make Debug representations of [`FixedBitSet`] easier
/// to read, when used to store [`SparseSetIndex`]. /// to read, when used to store [`SparseSetIndex`].
@ -1277,8 +1276,9 @@ impl<T: SparseSetIndex> Default for FilteredAccessSet<T> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::query::access::AccessFilters; use crate::query::{
use crate::query::{Access, AccessConflicts, FilteredAccess, FilteredAccessSet}; access::AccessFilters, Access, AccessConflicts, FilteredAccess, FilteredAccessSet,
};
use fixedbitset::FixedBitSet; use fixedbitset::FixedBitSet;
use std::marker::PhantomData; use std::marker::PhantomData;

View file

@ -1,7 +1,9 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use crate::component::StorageType; use crate::{
use crate::{component::ComponentId, prelude::*}; component::{ComponentId, StorageType},
prelude::*,
};
use super::{FilteredAccess, QueryData, QueryFilter}; use super::{FilteredAccess, QueryData, QueryFilter};
@ -32,7 +34,7 @@ use super::{FilteredAccess, QueryData, QueryFilter};
/// ///
/// // Consume the QueryState /// // Consume the QueryState
/// let (entity, b) = query.single(&world); /// let (entity, b) = query.single(&world);
///``` /// ```
pub struct QueryBuilder<'w, D: QueryData = (), F: QueryFilter = ()> { pub struct QueryBuilder<'w, D: QueryData = (), F: QueryFilter = ()> {
access: FilteredAccess<ComponentId>, access: FilteredAccess<ComponentId>,
world: &'w mut World, world: &'w mut World,
@ -275,8 +277,7 @@ 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 as bevy_ecs;
use crate::prelude::*; use crate::{prelude::*, world::FilteredEntityRef};
use crate::world::FilteredEntityRef;
#[derive(Component, PartialEq, Debug)] #[derive(Component, PartialEq, Debug)]
struct A(usize); struct A(usize);

View file

@ -1005,7 +1005,6 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIter<'w, 's, D, F> {
/// # Panics /// # Panics
/// ///
/// This will panic if `next` has been called on `QueryIter` before, unless the underlying `Query` is empty. /// This will panic if `next` has been called on `QueryIter` before, unless the underlying `Query` is empty.
///
pub fn sort_by_cached_key<L: ReadOnlyQueryData + 'w, K>( pub fn sort_by_cached_key<L: ReadOnlyQueryData + 'w, K>(
self, self,
mut f: impl FnMut(&L::Item<'w>) -> K, mut f: impl FnMut(&L::Item<'w>) -> K,
@ -1582,7 +1581,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter, const K: usize> QueryCombinationIter<
/// The lifetime here is not restrictive enough for Fetch with &mut access, /// The lifetime here is not restrictive enough for Fetch with &mut access,
/// as calling `fetch_next_aliased_unchecked` multiple times can produce multiple /// as calling `fetch_next_aliased_unchecked` multiple times can produce multiple
/// references to the same component, leading to unique reference aliasing. /// references to the same component, leading to unique reference aliasing.
///. /// .
/// It is always safe for shared access. /// It is always safe for shared access.
#[inline] #[inline]
unsafe fn fetch_next_aliased_unchecked(&mut self) -> Option<[D::Item<'w>; K]> { unsafe fn fetch_next_aliased_unchecked(&mut self) -> Option<[D::Item<'w>; K]> {

View file

@ -103,16 +103,17 @@ impl<T> DebugCheckedUnwrap for Option<T> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::prelude::{AnyOf, Changed, Entity, Or, QueryState, With, Without}; use crate::{
use crate::query::{ArchetypeFilter, Has, QueryCombinationIter, ReadOnlyQueryData}; self as bevy_ecs,
use crate::schedule::{IntoSystemConfigs, Schedule}; component::Component,
use crate::system::{IntoSystem, Query, System, SystemState}; prelude::{AnyOf, Changed, Entity, Or, QueryState, With, Without},
use crate::{self as bevy_ecs, component::Component, world::World}; query::{ArchetypeFilter, Has, QueryCombinationIter, ReadOnlyQueryData},
schedule::{IntoSystemConfigs, Schedule},
system::{IntoSystem, Query, System, SystemState},
world::World,
};
use bevy_ecs_macros::{QueryData, QueryFilter}; use bevy_ecs_macros::{QueryData, QueryFilter};
use std::any::type_name; use std::{any::type_name, collections::HashSet, fmt::Debug, hash::Hash};
use std::collections::HashSet;
use std::fmt::Debug;
use std::hash::Hash;
#[derive(Component, Debug, Hash, Eq, PartialEq, Clone, Copy, PartialOrd, Ord)] #[derive(Component, Debug, Hash, Eq, PartialEq, Clone, Copy, PartialOrd, Ord)]
struct A(usize); struct A(usize);

View file

@ -1719,8 +1719,9 @@ 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 as bevy_ecs;
use crate::world::FilteredEntityRef; use crate::{
use crate::{component::Component, prelude::*, query::QueryEntityError}; component::Component, prelude::*, query::QueryEntityError, world::FilteredEntityRef,
};
#[test] #[test]
fn get_many_unchecked_manual_uniqueness() { fn get_many_unchecked_manual_uniqueness() {

View file

@ -1,15 +1,12 @@
use crate::prelude::Mut;
use crate::reflect::AppTypeRegistry;
use crate::system::{EntityCommands, Resource};
use crate::world::Command;
use crate::{ use crate::{
entity::Entity, entity::Entity,
reflect::{ReflectBundle, ReflectComponent}, prelude::Mut,
world::World, reflect::{AppTypeRegistry, ReflectBundle, ReflectComponent},
system::{EntityCommands, Resource},
world::{Command, World},
}; };
use bevy_reflect::{PartialReflect, TypeRegistry}; use bevy_reflect::{PartialReflect, TypeRegistry};
use std::borrow::Cow; use std::{borrow::Cow, marker::PhantomData};
use std::marker::PhantomData;
/// An extension trait for [`EntityCommands`] for reflection related functions /// An extension trait for [`EntityCommands`] for reflection related functions
pub trait ReflectCommandExt { pub trait ReflectCommandExt {
@ -86,7 +83,6 @@ pub trait ReflectCommandExt {
/// .spawn_empty() /// .spawn_empty()
/// .insert_reflect(prefab.data.clone_value()); /// .insert_reflect(prefab.data.clone_value());
/// } /// }
///
/// ``` /// ```
fn insert_reflect(&mut self, component: Box<dyn PartialReflect>) -> &mut Self; fn insert_reflect(&mut self, component: Box<dyn PartialReflect>) -> &mut Self;
@ -161,7 +157,6 @@ pub trait ReflectCommandExt {
/// commands.entity(prefab.entity) /// commands.entity(prefab.entity)
/// .remove_reflect(prefab.data.reflect_type_path().to_owned()); /// .remove_reflect(prefab.data.reflect_type_path().to_owned());
/// } /// }
///
/// ``` /// ```
fn remove_reflect(&mut self, component_type_name: impl Into<Cow<'static, str>>) -> &mut Self; fn remove_reflect(&mut self, component_type_name: impl Into<Cow<'static, str>>) -> &mut Self;
/// Same as [`remove_reflect`](ReflectCommandExt::remove_reflect), but using the `T` resource as type registry instead of /// Same as [`remove_reflect`](ReflectCommandExt::remove_reflect), but using the `T` resource as type registry instead of
@ -351,10 +346,15 @@ impl<T: Resource + AsRef<TypeRegistry>> Command for RemoveReflectWithRegistry<T>
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::prelude::{AppTypeRegistry, ReflectComponent}; use crate::{
use crate::reflect::{ReflectBundle, ReflectCommandExt}; self as bevy_ecs,
use crate::system::{Commands, SystemState}; bundle::Bundle,
use crate::{self as bevy_ecs, bundle::Bundle, component::Component, world::World}; component::Component,
prelude::{AppTypeRegistry, ReflectComponent},
reflect::{ReflectBundle, ReflectCommandExt},
system::{Commands, SystemState},
world::World,
};
use bevy_ecs_macros::Resource; use bevy_ecs_macros::Resource;
use bevy_reflect::{PartialReflect, Reflect, TypeRegistry}; use bevy_reflect::{PartialReflect, Reflect, TypeRegistry};

View file

@ -6,6 +6,7 @@ use crate::{
use bevy_reflect::FromType; use bevy_reflect::FromType;
/// For a specific type of component, this maps any fields with values of type [`Entity`] to a new world. /// For a specific type of component, this maps any fields with values of type [`Entity`] to a new world.
///
/// Since a given `Entity` ID is only valid for the world it came from, when performing deserialization /// Since a given `Entity` ID is only valid for the world it came from, when performing deserialization
/// any stored IDs need to be re-allocated in the destination world. /// any stored IDs need to be re-allocated in the destination world.
/// ///
@ -75,6 +76,7 @@ impl<C: Component + MapEntities> FromType<C> for ReflectMapEntities {
} }
/// For a specific type of resource, this maps any fields with values of type [`Entity`] to a new world. /// For a specific type of resource, this maps any fields with values of type [`Entity`] to a new world.
///
/// Since a given `Entity` ID is only valid for the world it came from, when performing deserialization /// Since a given `Entity` ID is only valid for the world it came from, when performing deserialization
/// any stored IDs need to be re-allocated in the destination world. /// any stored IDs need to be re-allocated in the destination world.
/// ///

View file

@ -1,13 +1,15 @@
//! Types that enable reflection support. //! Types that enable reflection support.
use std::any::TypeId; use std::{
use std::ops::{Deref, DerefMut}; any::TypeId,
ops::{Deref, DerefMut},
};
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::{system::Resource, world::World}; use crate::{system::Resource, world::World};
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::{ use bevy_reflect::{
PartialReflect, Reflect, ReflectFromReflect, TypePath, TypeRegistry, TypeRegistryArc, std_traits::ReflectDefault, PartialReflect, Reflect, ReflectFromReflect, TypePath,
TypeRegistry, TypeRegistryArc,
}; };
mod bundle; mod bundle;

View file

@ -1,5 +1,4 @@
use std::borrow::Cow; use std::{borrow::Cow, ops::Not};
use std::ops::Not;
use crate::system::{ use crate::system::{
Adapt, AdapterSystem, CombinatorSystem, Combine, IntoSystem, ReadOnlySystem, System, SystemIn, Adapt, AdapterSystem, CombinatorSystem, Combine, IntoSystem, ReadOnlySystem, System, SystemIn,
@ -1351,12 +1350,14 @@ where
mod tests { mod tests {
use super::{common_conditions::*, Condition}; use super::{common_conditions::*, Condition};
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::component::Component; use crate::{
use crate::schedule::IntoSystemConfigs; change_detection::ResMut,
use crate::system::Local; component::Component,
use crate::{change_detection::ResMut, schedule::Schedule, world::World}; schedule::{IntoSystemConfigs, Schedule},
use bevy_ecs_macros::Event; system::Local,
use bevy_ecs_macros::Resource; world::World,
};
use bevy_ecs_macros::{Event, Resource};
#[derive(Resource, Default)] #[derive(Resource, Default)]
struct Counter(usize); struct Counter(usize);

View file

@ -2,9 +2,11 @@ mod multi_threaded;
mod simple; mod simple;
mod single_threaded; mod single_threaded;
pub use self::multi_threaded::{MainThreadExecutor, MultiThreadedExecutor}; pub use self::{
pub use self::simple::SimpleExecutor; multi_threaded::{MainThreadExecutor, MultiThreadedExecutor},
pub use self::single_threaded::SingleThreadedExecutor; simple::SimpleExecutor,
single_threaded::SingleThreadedExecutor,
};
use fixedbitset::FixedBitSet; use fixedbitset::FixedBitSet;
@ -127,6 +129,7 @@ pub(super) fn is_apply_deferred(system: &BoxedSystem) -> bool {
} }
/// These functions hide the bottom of the callstack from `RUST_BACKTRACE=1` (assuming the default panic handler is used). /// These functions hide the bottom of the callstack from `RUST_BACKTRACE=1` (assuming the default panic handler is used).
///
/// The full callstack will still be visible with `RUST_BACKTRACE=full`. /// The full callstack will still be visible with `RUST_BACKTRACE=full`.
/// They are specialized for `System::run` & co instead of being generic over closures because this avoids an /// They are specialized for `System::run` & co instead of being generic over closures because this avoids an
/// extra frame in the backtrace. /// extra frame in the backtrace.

View file

@ -4,10 +4,9 @@ use std::{
}; };
use bevy_tasks::{ComputeTaskPool, Scope, TaskPool, ThreadExecutor}; use bevy_tasks::{ComputeTaskPool, Scope, TaskPool, ThreadExecutor};
use bevy_utils::default;
use bevy_utils::syncunsafecell::SyncUnsafeCell;
#[cfg(feature = "trace")] #[cfg(feature = "trace")]
use bevy_utils::tracing::{info_span, Span}; use bevy_utils::tracing::{info_span, Span};
use bevy_utils::{default, syncunsafecell::SyncUnsafeCell};
use std::panic::AssertUnwindSafe; use std::panic::AssertUnwindSafe;
use concurrent_queue::ConcurrentQueue; use concurrent_queue::ConcurrentQueue;

View file

@ -9,12 +9,8 @@ mod schedule;
mod set; mod set;
mod stepping; mod stepping;
pub use self::condition::*;
pub use self::config::*;
pub use self::executor::*;
use self::graph_utils::*; use self::graph_utils::*;
pub use self::schedule::*; pub use self::{condition::*, config::*, executor::*, schedule::*, set::*};
pub use self::set::*;
pub use self::graph_utils::NodeId; pub use self::graph_utils::NodeId;
@ -24,9 +20,11 @@ mod tests {
use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::atomic::{AtomicU32, Ordering};
pub use crate as bevy_ecs; pub use crate as bevy_ecs;
pub use crate::schedule::{Schedule, SystemSet}; pub use crate::{
pub use crate::system::{Res, ResMut}; prelude::World,
pub use crate::{prelude::World, system::Resource}; schedule::{Schedule, SystemSet},
system::{Res, ResMut, Resource},
};
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
enum TestSet { enum TestSet {
@ -1158,7 +1156,7 @@ mod tests {
world.allow_ambiguous_resource::<R>(); world.allow_ambiguous_resource::<R>();
let mut schedule = Schedule::new(TestSchedule); let mut schedule = Schedule::new(TestSchedule);
//check resource // check resource
schedule.add_systems((resmut_system, res_system)); schedule.add_systems((resmut_system, res_system));
schedule.initialize(&mut world).unwrap(); schedule.initialize(&mut world).unwrap();
assert!(schedule.graph().conflicting_systems().is_empty()); assert!(schedule.graph().conflicting_systems().is_empty());

View file

@ -5,9 +5,9 @@ use std::{
#[cfg(feature = "trace")] #[cfg(feature = "trace")]
use bevy_utils::tracing::info_span; use bevy_utils::tracing::info_span;
use bevy_utils::{default, tracing::info};
use bevy_utils::{ use bevy_utils::{
tracing::{error, warn}, default,
tracing::{error, info, warn},
HashMap, HashSet, HashMap, HashSet,
}; };
use disqualified::ShortName; use disqualified::ShortName;
@ -24,8 +24,7 @@ use crate::{
world::World, world::World,
}; };
use crate::query::AccessConflicts; use crate::{query::AccessConflicts, storage::SparseSetIndex};
use crate::storage::SparseSetIndex;
pub use stepping::Stepping; pub use stepping::Stepping;
/// Resource that stores [`Schedule`]s mapped to [`ScheduleLabel`]s excluding the current running [`Schedule`]. /// Resource that stores [`Schedule`]s mapped to [`ScheduleLabel`]s excluding the current running [`Schedule`].

View file

@ -1,7 +1,9 @@
use std::any::TypeId; use std::{
use std::fmt::Debug; any::TypeId,
use std::hash::{Hash, Hasher}; fmt::Debug,
use std::marker::PhantomData; hash::{Hash, Hasher},
marker::PhantomData,
};
pub use crate::label::DynEq; pub use crate::label::DynEq;
pub use bevy_ecs_macros::{ScheduleLabel, SystemSet}; pub use bevy_ecs_macros::{ScheduleLabel, SystemSet};

View file

@ -1,6 +1,5 @@
use fixedbitset::FixedBitSet; use fixedbitset::FixedBitSet;
use std::any::TypeId; use std::{any::TypeId, collections::HashMap};
use std::collections::HashMap;
use crate::{ use crate::{
schedule::{InternedScheduleLabel, NodeId, Schedule, ScheduleLabel}, schedule::{InternedScheduleLabel, NodeId, Schedule, ScheduleLabel},
@ -827,8 +826,7 @@ impl ScheduleState {
#[cfg(all(test, feature = "bevy_debug_stepping"))] #[cfg(all(test, feature = "bevy_debug_stepping"))]
mod tests { mod tests {
use super::*; use super::*;
use crate::prelude::*; use crate::{prelude::*, schedule::ScheduleLabel};
use crate::schedule::ScheduleLabel;
pub use crate as bevy_ecs; pub use crate as bevy_ecs;

View file

@ -1,7 +1,9 @@
use crate::archetype::ArchetypeComponentId; use crate::{
use crate::change_detection::{MaybeLocation, MaybeUnsafeCellLocation, MutUntyped, TicksMut}; archetype::ArchetypeComponentId,
use crate::component::{ComponentId, ComponentTicks, Components, Tick, TickCells}; change_detection::{MaybeLocation, MaybeUnsafeCellLocation, MutUntyped, TicksMut},
use crate::storage::{blob_vec::BlobVec, SparseSet}; component::{ComponentId, ComponentTicks, Components, Tick, TickCells},
storage::{blob_vec::BlobVec, SparseSet},
};
use bevy_ptr::{OwningPtr, Ptr, UnsafeCellDeref}; use bevy_ptr::{OwningPtr, Ptr, UnsafeCellDeref};
#[cfg(feature = "track_change_detection")] #[cfg(feature = "track_change_detection")]
use std::panic::Location; use std::panic::Location;

View file

@ -6,6 +6,7 @@ use crate::{
use bevy_ptr::PtrMut; use bevy_ptr::PtrMut;
/// Very similar to a normal [`Column`], but with the capacities and lengths cut out for performance reasons. /// Very similar to a normal [`Column`], but with the capacities and lengths cut out for performance reasons.
///
/// This type is used by [`Table`], because all of the capacities and lengths of the [`Table`]'s columns must match. /// This type is used by [`Table`], because all of the capacities and lengths of the [`Table`]'s columns must match.
/// ///
/// Like many other low-level storage types, [`ThinColumn`] has a limited and highly unsafe /// Like many other low-level storage types, [`ThinColumn`] has a limited and highly unsafe
@ -411,7 +412,6 @@ impl Column {
/// ///
/// # Safety /// # Safety
/// `row` must be within the range `[0, self.len())`. /// `row` must be within the range `[0, self.len())`.
///
#[inline] #[inline]
pub(crate) unsafe fn swap_remove_unchecked(&mut self, row: TableRow) { pub(crate) unsafe fn swap_remove_unchecked(&mut self, row: TableRow) {
self.data.swap_remove_and_drop_unchecked(row.as_usize()); self.data.swap_remove_and_drop_unchecked(row.as_usize());

View file

@ -10,9 +10,10 @@ use bevy_utils::HashMap;
pub use column::*; pub use column::*;
#[cfg(feature = "track_change_detection")] #[cfg(feature = "track_change_detection")]
use std::panic::Location; use std::panic::Location;
use std::{alloc::Layout, num::NonZeroUsize};
use std::{ use std::{
alloc::Layout,
cell::UnsafeCell, cell::UnsafeCell,
num::NonZeroUsize,
ops::{Index, IndexMut}, ops::{Index, IndexMut},
}; };
mod column; mod column;
@ -814,13 +815,11 @@ impl Drop for Table {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::component::Component;
use crate::ptr::OwningPtr;
use crate::storage::Storages;
use crate::{ use crate::{
component::{Components, Tick}, component::{Component, Components, Tick},
entity::Entity, entity::Entity,
storage::{TableBuilder, TableRow}, ptr::OwningPtr,
storage::{Storages, TableBuilder, TableRow},
}; };
#[cfg(feature = "track_change_detection")] #[cfg(feature = "track_change_detection")]
use std::panic::Location; use std::panic::Location;

View file

@ -1,8 +1,10 @@
use crate::query::DebugCheckedUnwrap; use crate::query::DebugCheckedUnwrap;
use std::alloc::{alloc, handle_alloc_error, realloc, Layout}; use std::{
use std::mem::{needs_drop, size_of}; alloc::{alloc, handle_alloc_error, realloc, Layout},
use std::num::NonZeroUsize; mem::{needs_drop, size_of},
use std::ptr::{self, NonNull}; num::NonZeroUsize,
ptr::{self, NonNull},
};
/// Similar to [`Vec<T>`], but with the capacity and length cut out for performance reasons. /// Similar to [`Vec<T>`], but with the capacity and length cut out for performance reasons.
/// ///

View file

@ -71,7 +71,7 @@ use super::{init_query_param, Res, ResMut, Resource, SystemState};
/// .build_system(single_parameter_system); /// .build_system(single_parameter_system);
/// ///
/// world.run_system_once(system); /// world.run_system_once(system);
///``` /// ```
/// ///
/// # Safety /// # Safety
/// ///
@ -227,6 +227,7 @@ unsafe impl<P: SystemParam, B: SystemParamBuilder<P>> SystemParamBuilder<Vec<P>>
} }
/// A [`SystemParamBuilder`] for a [`ParamSet`]. /// A [`SystemParamBuilder`] for a [`ParamSet`].
///
/// To build a [`ParamSet`] with a tuple of system parameters, pass a tuple of matching [`SystemParamBuilder`]s. /// To build a [`ParamSet`] with a tuple of system parameters, pass a tuple of matching [`SystemParamBuilder`]s.
/// To build a [`ParamSet`] with a `Vec` of system parameters, pass a `Vec` of matching [`SystemParamBuilder`]s. /// To build a [`ParamSet`] with a `Vec` of system parameters, pass a `Vec` of matching [`SystemParamBuilder`]s.
pub struct ParamSetBuilder<T>(pub T); pub struct ParamSetBuilder<T>(pub T);
@ -348,9 +349,11 @@ unsafe impl<'s, T: FromWorld + Send + 'static> SystemParamBuilder<Local<'s, T>>
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::entity::Entities; use crate::{
use crate::prelude::{Component, Query}; entity::Entities,
use crate::system::{Local, RunSystemOnce}; prelude::{Component, Query},
system::{Local, RunSystemOnce},
};
use super::*; use super::*;

View file

@ -1777,6 +1777,7 @@ unsafe fn insert_by_id<T: Send + 'static>(
} }
/// An [`EntityCommand`] that removes components from an entity. /// An [`EntityCommand`] that removes components from an entity.
///
/// For a [`Bundle`] type `T`, this will remove any components in the bundle. /// For a [`Bundle`] type `T`, this will remove any components in the bundle.
/// Any components in the bundle that aren't found on the entity will be ignored. /// Any components in the bundle that aren't found on the entity will be ignored.
fn remove<T: Bundle>(entity: Entity, world: &mut World) { fn remove<T: Bundle>(entity: Entity, world: &mut World) {
@ -1807,6 +1808,7 @@ fn clear() -> impl EntityCommand {
} }
/// An [`EntityCommand`] that removes components from an entity. /// An [`EntityCommand`] that removes components from an entity.
///
/// For a [`Bundle`] type `T`, this will remove all components except those in the bundle. /// For a [`Bundle`] type `T`, this will remove all components except those in the bundle.
/// Any components in the bundle that aren't found on the entity will be ignored. /// Any components in the bundle that aren't found on the entity will be ignored.
fn retain<T: Bundle>(entity: Entity, world: &mut World) { fn retain<T: Bundle>(entity: Entity, world: &mut World) {

View file

@ -39,7 +39,7 @@ struct ParallelCommandQueue {
/// }); /// });
/// } /// }
/// # bevy_ecs::system::assert_is_system(parallel_command_system); /// # bevy_ecs::system::assert_is_system(parallel_command_system);
///``` /// ```
#[derive(SystemParam)] #[derive(SystemParam)]
pub struct ParallelCommands<'w, 's> { pub struct ParallelCommands<'w, 's> {
state: Deferred<'s, ParallelCommandQueue>, state: Deferred<'s, ParallelCommandQueue>,

View file

@ -4,8 +4,7 @@ use crate::{
system::{Local, SystemMeta, SystemParam, SystemState}, system::{Local, SystemMeta, SystemParam, SystemState},
world::World, world::World,
}; };
use bevy_utils::all_tuples; use bevy_utils::{all_tuples, synccell::SyncCell};
use bevy_utils::synccell::SyncCell;
use std::marker::PhantomData; use std::marker::PhantomData;
/// A parameter that can be used in an exclusive system (a system with an `&mut World` parameter). /// A parameter that can be used in an exclusive system (a system with an `&mut World` parameter).
@ -125,9 +124,7 @@ all_tuples!(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate as bevy_ecs; use crate as bevy_ecs;
use crate::schedule::Schedule; use crate::{schedule::Schedule, system::Local, world::World};
use crate::system::Local;
use crate::world::World;
use bevy_ecs_macros::Resource; use bevy_ecs_macros::Resource;
use std::marker::PhantomData; use std::marker::PhantomData;

View file

@ -307,8 +307,6 @@ mod tests {
use bevy_utils::default; use bevy_utils::default;
use std::any::TypeId; use std::any::TypeId;
use crate::prelude::EntityRef;
use crate::world::EntityMut;
use crate::{ use crate::{
self as bevy_ecs, self as bevy_ecs,
archetype::{ArchetypeComponentId, Archetypes}, archetype::{ArchetypeComponentId, Archetypes},
@ -316,7 +314,7 @@ mod tests {
change_detection::DetectChanges, change_detection::DetectChanges,
component::{Component, Components, Tick}, component::{Component, Components, Tick},
entity::{Entities, Entity}, entity::{Entities, Entity},
prelude::AnyOf, prelude::{AnyOf, EntityRef},
query::{Added, Changed, Or, With, Without}, query::{Added, Changed, Or, With, Without},
removal_detection::RemovedComponents, removal_detection::RemovedComponents,
schedule::{ schedule::{
@ -327,7 +325,7 @@ mod tests {
Commands, In, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, Res, ResMut, Commands, In, IntoSystem, Local, NonSend, NonSendMut, ParamSet, Query, Res, ResMut,
Resource, StaticSystemParam, System, SystemState, Resource, StaticSystemParam, System, SystemState,
}, },
world::{FromWorld, World}, world::{EntityMut, FromWorld, World},
}; };
#[derive(Resource, PartialEq, Debug)] #[derive(Resource, PartialEq, Debug)]

View file

@ -1,16 +1,16 @@
use bevy_utils::tracing::warn; use bevy_utils::tracing::warn;
use core::fmt::Debug; use core::fmt::Debug;
use crate::component::Tick; use crate::{
use crate::schedule::InternedSystemSet; archetype::ArchetypeComponentId,
use crate::system::input::SystemInput; component::{ComponentId, Tick},
use crate::system::SystemIn; query::Access,
use crate::world::unsafe_world_cell::UnsafeWorldCell; schedule::InternedSystemSet,
use crate::world::DeferredWorld; system::{input::SystemInput, SystemIn},
use crate::{archetype::ArchetypeComponentId, component::ComponentId, query::Access, world::World}; world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World},
};
use std::any::TypeId; use std::{any::TypeId, borrow::Cow};
use std::borrow::Cow;
use super::IntoSystem; use super::IntoSystem;

View file

@ -1,9 +1,10 @@
use crate::component::Tick; use crate::{
use crate::prelude::World; component::Tick,
use crate::system::{ExclusiveSystemParam, ReadOnlySystemParam, SystemMeta, SystemParam}; prelude::World,
use crate::world::unsafe_world_cell::UnsafeWorldCell; system::{ExclusiveSystemParam, ReadOnlySystemParam, SystemMeta, SystemParam},
use std::borrow::Cow; world::unsafe_world_cell::UnsafeWorldCell,
use std::ops::Deref; };
use std::{borrow::Cow, ops::Deref};
/// [`SystemParam`] that returns the name of the system which it is used in. /// [`SystemParam`] that returns the name of the system which it is used in.
/// ///
@ -105,8 +106,10 @@ impl ExclusiveSystemParam for SystemName<'_> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::system::{IntoSystem, RunSystemOnce, SystemName}; use crate::{
use crate::world::World; system::{IntoSystem, RunSystemOnce, SystemName},
world::World,
};
#[test] #[test]
fn test_system_name_regular_param() { fn test_system_name_regular_param() {

View file

@ -1,5 +1,4 @@
pub use crate::change_detection::{NonSendMut, Res, ResMut}; pub use crate::change_detection::{NonSendMut, Res, ResMut};
use crate::storage::SparseSetIndex;
use crate::{ use crate::{
archetype::{Archetype, Archetypes}, archetype::{Archetype, Archetypes},
bundle::Bundles, bundle::Bundles,
@ -7,16 +6,15 @@ use crate::{
component::{ComponentId, ComponentTicks, Components, Tick}, component::{ComponentId, ComponentTicks, Components, Tick},
entity::Entities, entity::Entities,
query::{ query::{
Access, FilteredAccess, FilteredAccessSet, QueryData, QueryFilter, QueryState, Access, AccessConflicts, FilteredAccess, FilteredAccessSet, QueryData, QueryFilter,
ReadOnlyQueryData, QueryState, ReadOnlyQueryData,
}, },
storage::{ResourceData, SparseSetIndex},
system::{Query, SystemMeta}, system::{Query, SystemMeta},
world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, FromWorld, World}, world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, FromWorld, World},
}; };
use crate::{query::AccessConflicts, storage::ResourceData};
use bevy_ecs_macros::impl_param_set; use bevy_ecs_macros::impl_param_set;
pub use bevy_ecs_macros::Resource; pub use bevy_ecs_macros::{Resource, SystemParam};
pub use bevy_ecs_macros::SystemParam;
use bevy_ptr::UnsafeCellDeref; use bevy_ptr::UnsafeCellDeref;
use bevy_utils::{all_tuples, synccell::SyncCell}; use bevy_utils::{all_tuples, synccell::SyncCell};
#[cfg(feature = "track_change_detection")] #[cfg(feature = "track_change_detection")]
@ -69,7 +67,7 @@ use std::{
/// # eventwriter: /// # eventwriter:
/// EventWriter<'w, SomeEvent> /// EventWriter<'w, SomeEvent>
/// # } /// # }
///``` /// ```
/// ## `PhantomData` /// ## `PhantomData`
/// ///
/// [`PhantomData`] is a special type of `SystemParam` that does nothing. /// [`PhantomData`] is a special type of `SystemParam` that does nothing.
@ -494,7 +492,7 @@ fn assert_component_access_compatibility(
/// )),) /// )),)
/// .build_state(&mut world) /// .build_state(&mut world)
/// .build_system(buildable_system); /// .build_system(buildable_system);
///world.run_system_once(system); /// world.run_system_once(system);
/// ///
/// fn buildable_system(mut set: ParamSet<(Query<&mut Health>, Query<&mut Health>, &World)>) { /// fn buildable_system(mut set: ParamSet<(Query<&mut Health>, Query<&mut Health>, &World)>) {
/// // The first parameter is built from the first builder, /// // The first parameter is built from the first builder,
@ -1874,7 +1872,6 @@ pub mod lifetimeless {
/// # bevy_ecs::system::assert_is_system(do_thing_generically::<T>); /// # bevy_ecs::system::assert_is_system(do_thing_generically::<T>);
/// # } /// # }
/// ``` /// ```
///
pub struct StaticSystemParam<'w, 's, P: SystemParam>(SystemParamItem<'w, 's, P>); pub struct StaticSystemParam<'w, 's, P: SystemParam>(SystemParamItem<'w, 's, P>);
impl<'w, 's, P: SystemParam> Deref for StaticSystemParam<'w, 's, P> { impl<'w, 's, P: SystemParam> Deref for StaticSystemParam<'w, 's, P> {
@ -1973,6 +1970,7 @@ unsafe impl<T: ?Sized> SystemParam for PhantomData<T> {
unsafe impl<T: ?Sized> ReadOnlySystemParam for PhantomData<T> {} unsafe impl<T: ?Sized> ReadOnlySystemParam for PhantomData<T> {}
/// A [`SystemParam`] with a type that can be configured at runtime. /// A [`SystemParam`] with a type that can be configured at runtime.
///
/// To be useful, this must be configured using a [`DynParamBuilder`](crate::system::DynParamBuilder) to build the system using a [`SystemParamBuilder`](crate::prelude::SystemParamBuilder). /// To be useful, this must be configured using a [`DynParamBuilder`](crate::system::DynParamBuilder) to build the system using a [`SystemParamBuilder`](crate::prelude::SystemParamBuilder).
/// ///
/// # Examples /// # Examples

View file

@ -1,10 +1,11 @@
use crate::bundle::Bundle; use crate::{
use crate::change_detection::Mut; bundle::Bundle,
use crate::entity::Entity; change_detection::Mut,
use crate::system::input::SystemInput; entity::Entity,
use crate::system::{BoxedSystem, IntoSystem, System, SystemIn}; system::{input::SystemInput, BoxedSystem, IntoSystem, System, SystemIn},
use crate::world::{Command, World}; world::{Command, World},
use crate::{self as bevy_ecs}; {self as bevy_ecs},
};
use bevy_ecs_macros::{Component, Resource}; use bevy_ecs_macros::{Component, Resource};
use thiserror::Error; use thiserror::Error;

View file

@ -26,7 +26,6 @@ struct CommandMeta {
} }
/// Densely and efficiently stores a queue of heterogenous types implementing [`Command`]. /// Densely and efficiently stores a queue of heterogenous types implementing [`Command`].
//
// NOTE: [`CommandQueue`] is implemented via a `Vec<MaybeUninit<u8>>` instead of a `Vec<Box<dyn Command>>` // NOTE: [`CommandQueue`] is implemented via a `Vec<MaybeUninit<u8>>` instead of a `Vec<Box<dyn Command>>`
// as an optimization. Since commands are used frequently in systems as a way to spawn // as an optimization. Since commands are used frequently in systems as a way to spawn
// entities/components/resources, and it's not currently possible to parallelize these // entities/components/resources, and it's not currently possible to parallelize these

View file

@ -555,6 +555,7 @@ impl<'a> TryFrom<&'a mut FilteredEntityMut<'_>> for EntityMut<'a> {
} }
/// A mutable reference to a particular [`Entity`], and the entire world. /// A mutable reference to a particular [`Entity`], and the entire world.
///
/// This is essentially a performance-optimized `(Entity, &mut World)` tuple, /// This is essentially a performance-optimized `(Entity, &mut World)` tuple,
/// which caches the [`EntityLocation`] to reduce duplicate lookups. /// which caches the [`EntityLocation`] to reduce duplicate lookups.
/// ///
@ -1049,7 +1050,6 @@ impl<'w> EntityWorldMut<'w> {
/// this fn as if the code here was written inline /// this fn as if the code here was written inline
/// ///
/// when DROP is true removed components will be dropped otherwise they will be forgotten /// when DROP is true removed components will be dropped otherwise they will be forgotten
///
// We use a const generic here so that we are less reliant on // We use a const generic here so that we are less reliant on
// inlining for rustc to optimize out the `match DROP` // inlining for rustc to optimize out the `match DROP`
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -1488,7 +1488,6 @@ impl<'w> EntityWorldMut<'w> {
/// # let mut entity = world.get_entity_mut(entity_id).unwrap(); /// # let mut entity = world.get_entity_mut(entity_id).unwrap();
/// entity.entry::<Comp>().and_modify(|mut c| c.0 += 1); /// entity.entry::<Comp>().and_modify(|mut c| c.0 += 1);
/// assert_eq!(world.query::<&Comp>().single(&world).0, 5); /// assert_eq!(world.query::<&Comp>().single(&world).0, 5);
///
/// ``` /// ```
pub fn entry<'a, T: Component>(&'a mut self) -> Entry<'w, 'a, T> { pub fn entry<'a, T: Component>(&'a mut self) -> Entry<'w, 'a, T> {
if self.contains::<T>() { if self.contains::<T>() {
@ -2787,9 +2786,13 @@ mod tests {
use bevy_ptr::OwningPtr; use bevy_ptr::OwningPtr;
use std::panic::AssertUnwindSafe; use std::panic::AssertUnwindSafe;
use crate::system::RunSystemOnce as _; use crate::{
use crate::world::{FilteredEntityMut, FilteredEntityRef}; self as bevy_ecs,
use crate::{self as bevy_ecs, component::ComponentId, prelude::*, system::assert_is_system}; component::ComponentId,
prelude::*,
system::{assert_is_system, RunSystemOnce as _},
world::{FilteredEntityMut, FilteredEntityRef},
};
use super::{EntityMutExcept, EntityRefExcept}; use super::{EntityMutExcept, EntityRefExcept};

Some files were not shown because too many files have changed in this diff Show more