Remove unnecessary path prefixes (#10749)

# Objective

- Shorten paths by removing unnecessary prefixes

## Solution

- Remove the prefixes from many paths which do not need them. Finding
the paths was done automatically using built-in refactoring tools in
Jetbrains RustRover.
This commit is contained in:
tygyh 2023-11-29 00:43:40 +01:00 committed by GitHub
parent b19ea0dd1d
commit fd308571c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
123 changed files with 335 additions and 414 deletions

View file

@ -889,7 +889,7 @@ impl App {
self
}
/// When doing [ambiguity checking](bevy_ecs::schedule::ScheduleBuildSettings) this
/// When doing [ambiguity checking](ScheduleBuildSettings) this
/// ignores systems that are ambiguous on [`Component`] T.
///
/// This settings only applies to the main world. To apply this to other worlds call the
@ -927,7 +927,7 @@ impl App {
self
}
/// When doing [ambiguity checking](bevy_ecs::schedule::ScheduleBuildSettings) this
/// When doing [ambiguity checking](ScheduleBuildSettings) this
/// ignores systems that are ambiguous on [`Resource`] T.
///
/// This settings only applies to the main world. To apply this to other worlds call the
@ -1004,19 +1004,19 @@ mod tests {
struct PluginA;
impl Plugin for PluginA {
fn build(&self, _app: &mut crate::App) {}
fn build(&self, _app: &mut App) {}
}
struct PluginB;
impl Plugin for PluginB {
fn build(&self, _app: &mut crate::App) {}
fn build(&self, _app: &mut App) {}
}
struct PluginC<T>(T);
impl<T: Send + Sync + 'static> Plugin for PluginC<T> {
fn build(&self, _app: &mut crate::App) {}
fn build(&self, _app: &mut App) {}
}
struct PluginD;
impl Plugin for PluginD {
fn build(&self, _app: &mut crate::App) {}
fn build(&self, _app: &mut App) {}
fn is_unique(&self) -> bool {
false
}
@ -1049,10 +1049,10 @@ mod tests {
struct PluginRun;
struct InnerPlugin;
impl Plugin for InnerPlugin {
fn build(&self, _: &mut crate::App) {}
fn build(&self, _: &mut App) {}
}
impl Plugin for PluginRun {
fn build(&self, app: &mut crate::App) {
fn build(&self, app: &mut App) {
app.add_plugins(InnerPlugin).run();
}
}

View file

@ -3,7 +3,7 @@ use proc_macro::{Span, TokenStream};
use quote::{format_ident, quote};
use syn::{parse_macro_input, Data, DeriveInput, Path};
pub(crate) fn bevy_asset_path() -> syn::Path {
pub(crate) fn bevy_asset_path() -> Path {
BevyManifest::default().get_path("bevy_asset")
}

View file

@ -22,9 +22,7 @@ pub const EMBEDDED: &str = "embedded";
pub struct EmbeddedAssetRegistry {
dir: Dir,
#[cfg(feature = "embedded_watcher")]
root_paths: std::sync::Arc<
parking_lot::RwLock<bevy_utils::HashMap<std::path::PathBuf, std::path::PathBuf>>,
>,
root_paths: std::sync::Arc<parking_lot::RwLock<bevy_utils::HashMap<PathBuf, PathBuf>>>,
}
impl EmbeddedAssetRegistry {

View file

@ -95,7 +95,7 @@ impl AssetReader for FileAssetReader {
fn is_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<bool, AssetReaderError>> {
) -> BoxedFuture<'a, Result<bool, AssetReaderError>> {
Box::pin(async move {
let full_path = self.root_path.join(path);
let metadata = full_path
@ -138,10 +138,7 @@ impl AssetWriter for FileAssetWriter {
})
}
fn remove<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
fn remove<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let full_path = self.root_path.join(path);
async_fs::remove_file(full_path).await?;
@ -149,10 +146,7 @@ impl AssetWriter for FileAssetWriter {
})
}
fn remove_meta<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
fn remove_meta<'a>(&'a self, path: &'a Path) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let meta_path = get_meta_path(path);
let full_path = self.root_path.join(meta_path);
@ -164,7 +158,7 @@ impl AssetWriter for FileAssetWriter {
fn remove_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let full_path = self.root_path.join(path);
async_fs::remove_dir_all(full_path).await?;
@ -175,7 +169,7 @@ impl AssetWriter for FileAssetWriter {
fn remove_empty_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let full_path = self.root_path.join(path);
async_fs::remove_dir(full_path).await?;
@ -186,7 +180,7 @@ impl AssetWriter for FileAssetWriter {
fn remove_assets_in_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let full_path = self.root_path.join(path);
async_fs::remove_dir_all(&full_path).await?;
@ -199,7 +193,7 @@ impl AssetWriter for FileAssetWriter {
&'a self,
old_path: &'a Path,
new_path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let full_old_path = self.root_path.join(old_path);
let full_new_path = self.root_path.join(new_path);
@ -215,7 +209,7 @@ impl AssetWriter for FileAssetWriter {
&'a self,
old_path: &'a Path,
new_path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<(), AssetWriterError>> {
) -> BoxedFuture<'a, Result<(), AssetWriterError>> {
Box::pin(async move {
let old_meta_path = get_meta_path(old_path);
let new_meta_path = get_meta_path(new_path);

View file

@ -243,7 +243,7 @@ pub(crate) fn new_asset_event_debouncer(
}
pub(crate) struct FileEventHandler {
sender: crossbeam_channel::Sender<AssetSourceEvent>,
sender: Sender<AssetSourceEvent>,
root: PathBuf,
last_event: Option<AssetSourceEvent>,
}

View file

@ -93,7 +93,7 @@ impl<R: AssetReader> AssetReader for GatedReader<R> {
fn is_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<bool, AssetReaderError>> {
) -> BoxedFuture<'a, Result<bool, AssetReaderError>> {
self.reader.is_directory(path)
}
}

View file

@ -216,10 +216,10 @@ struct DataReader {
impl AsyncRead for DataReader {
fn poll_read(
mut self: std::pin::Pin<&mut Self>,
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buf: &mut [u8],
) -> std::task::Poll<futures_io::Result<usize>> {
) -> Poll<futures_io::Result<usize>> {
if self.bytes_read >= self.data.value().len() {
Poll::Ready(Ok(0))
} else {
@ -286,7 +286,7 @@ impl AssetReader for MemoryAssetReader {
fn is_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<bool, AssetReaderError>> {
) -> BoxedFuture<'a, Result<bool, AssetReaderError>> {
Box::pin(async move { Ok(self.root.get_dir(path).is_some()) })
}
}

View file

@ -238,10 +238,10 @@ impl VecReader {
impl AsyncRead for VecReader {
fn poll_read(
mut self: std::pin::Pin<&mut Self>,
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buf: &mut [u8],
) -> std::task::Poll<futures_io::Result<usize>> {
) -> Poll<futures_io::Result<usize>> {
if self.bytes_read >= self.bytes.len() {
Poll::Ready(Ok(0))
} else {

View file

@ -118,7 +118,7 @@ impl AssetReader for ProcessorGatedReader {
fn is_directory<'a>(
&'a self,
path: &'a Path,
) -> BoxedFuture<'a, std::result::Result<bool, AssetReaderError>> {
) -> BoxedFuture<'a, Result<bool, AssetReaderError>> {
Box::pin(async move {
trace!(
"Waiting for processing to finish before reading directory {:?}",
@ -149,7 +149,7 @@ impl<'a> TransactionLockedReader<'a> {
impl<'a> AsyncRead for TransactionLockedReader<'a> {
fn poll_read(
mut self: std::pin::Pin<&mut Self>,
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buf: &mut [u8],
) -> std::task::Poll<futures_io::Result<usize>> {

View file

@ -67,7 +67,7 @@ compile_error!(
/// Supports flexible "modes", such as [`AssetMode::Processed`] and
/// [`AssetMode::Unprocessed`] that enable using the asset workflow that best suits your project.
///
/// [`AssetSource`]: crate::io::AssetSource
/// [`AssetSource`]: io::AssetSource
pub struct AssetPlugin {
/// The default file path to use (relative to the project root) for unprocessed assets.
pub file_path: String,
@ -88,8 +88,8 @@ pub struct AssetPlugin {
pub enum AssetMode {
/// Loads assets from their [`AssetSource`]'s default [`AssetReader`] without any "preprocessing".
///
/// [`AssetReader`]: crate::io::AssetReader
/// [`AssetSource`]: crate::io::AssetSource
/// [`AssetReader`]: io::AssetReader
/// [`AssetSource`]: io::AssetSource
Unprocessed,
/// Assets will be "pre-processed". This enables assets to be imported / converted / optimized ahead of time.
///
@ -102,9 +102,9 @@ pub enum AssetMode {
/// be used in combination with the `file_watcher` cargo feature, which enables hot-reloading of assets that have changed. When both features are enabled,
/// changes to "original/source assets" will be detected, the asset will be re-processed, and then the final processed asset will be hot-reloaded in the app.
///
/// [`AssetMeta`]: crate::meta::AssetMeta
/// [`AssetSource`]: crate::io::AssetSource
/// [`AssetReader`]: crate::io::AssetReader
/// [`AssetMeta`]: meta::AssetMeta
/// [`AssetSource`]: io::AssetSource
/// [`AssetReader`]: io::AssetReader
Processed,
}
@ -215,9 +215,9 @@ impl Plugin for AssetPlugin {
.init_asset::<()>()
.configure_sets(
UpdateAssets,
TrackAssets.after(server::handle_internal_asset_events),
TrackAssets.after(handle_internal_asset_events),
)
.add_systems(UpdateAssets, server::handle_internal_asset_events);
.add_systems(UpdateAssets, handle_internal_asset_events);
let mut order = app.world.resource_mut::<MainScheduleOrder>();
order.insert_after(First, UpdateAssets);

View file

@ -581,10 +581,10 @@ impl TypePath for AssetPath<'static> {
Some("AssetPath<'static>")
}
fn crate_name() -> Option<&'static str> {
Option::None
None
}
fn module_path() -> Option<&'static str> {
Option::None
None
}
}
impl Typed for AssetPath<'static> {
@ -602,15 +602,15 @@ impl Reflect for AssetPath<'static> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_any(self: Box<Self>) -> Box<dyn ::core::any::Any> {
fn into_any(self: Box<Self>) -> Box<dyn core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any {
fn as_any(&self) -> &dyn core::any::Any {
self
}
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any {
fn as_any_mut(&mut self) -> &mut dyn core::any::Any {
self
}
#[inline]
@ -663,19 +663,19 @@ impl Reflect for AssetPath<'static> {
}
fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool> {
let value = <dyn Reflect>::as_any(value);
if let Some(value) = <dyn ::core::any::Any>::downcast_ref::<Self>(value) {
Some(::core::cmp::PartialEq::eq(self, value))
if let Some(value) = <dyn core::any::Any>::downcast_ref::<Self>(value) {
Some(PartialEq::eq(self, value))
} else {
Some(false)
}
}
fn debug(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fn debug(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
::core::fmt::Debug::fmt(self, f)
}
}
impl FromReflect for AssetPath<'static> {
fn from_reflect(reflect: &dyn Reflect) -> Option<Self> {
Some(Clone::clone(<dyn ::core::any::Any>::downcast_ref::<
Some(Clone::clone(<dyn core::any::Any>::downcast_ref::<
AssetPath<'static>,
>(<dyn Reflect>::as_any(reflect))?))
}

View file

@ -421,7 +421,7 @@ impl AssetProcessor {
scope: &'scope bevy_tasks::Scope<'scope, '_, ()>,
source: &'scope AssetSource,
path: PathBuf,
) -> bevy_utils::BoxedFuture<'scope, Result<(), AssetReaderError>> {
) -> BoxedFuture<'scope, Result<(), AssetReaderError>> {
Box::pin(async move {
if source.reader().is_directory(&path).await? {
let mut path_stream = source.reader().read_directory(&path).await?;

View file

@ -15,7 +15,7 @@ use crate::AudioSink;
///
/// ## Note
///
/// Initializing this resource will leak [`rodio::OutputStream`]
/// Initializing this resource will leak [`OutputStream`]
/// using [`std::mem::forget`].
/// This is done to avoid storing this in the struct (and making this `!Send`)
/// while preventing it from dropping (to avoid halting of audio).

View file

@ -15,7 +15,7 @@ use std::{
/// The hash is eagerly re-computed upon each update to the name.
///
/// [`Name`] should not be treated as a globally unique identifier for entities,
/// as multiple entities can have the same name. [`bevy_ecs::entity::Entity`] should be
/// as multiple entities can have the same name. [`Entity`] should be
/// used instead as the default unique identifier.
#[derive(Reflect, Component, Clone)]
#[reflect(Component, Default, Debug)]

View file

@ -340,18 +340,16 @@ pub fn get_lut_bind_group_layout_entries() -> [BindGroupLayoutEntryBuilder; 2] {
// allow(dead_code) so it doesn't complain when the tonemapping_luts feature is disabled
#[allow(dead_code)]
fn setup_tonemapping_lut_image(bytes: &[u8], image_type: ImageType) -> Image {
let image_sampler = bevy_render::texture::ImageSampler::Descriptor(
bevy_render::texture::ImageSamplerDescriptor {
label: Some("Tonemapping LUT sampler".to_string()),
address_mode_u: bevy_render::texture::ImageAddressMode::ClampToEdge,
address_mode_v: bevy_render::texture::ImageAddressMode::ClampToEdge,
address_mode_w: bevy_render::texture::ImageAddressMode::ClampToEdge,
mag_filter: bevy_render::texture::ImageFilterMode::Linear,
min_filter: bevy_render::texture::ImageFilterMode::Linear,
mipmap_filter: bevy_render::texture::ImageFilterMode::Linear,
..default()
},
);
let image_sampler = ImageSampler::Descriptor(bevy_render::texture::ImageSamplerDescriptor {
label: Some("Tonemapping LUT sampler".to_string()),
address_mode_u: bevy_render::texture::ImageAddressMode::ClampToEdge,
address_mode_v: bevy_render::texture::ImageAddressMode::ClampToEdge,
address_mode_w: bevy_render::texture::ImageAddressMode::ClampToEdge,
mag_filter: bevy_render::texture::ImageFilterMode::Linear,
min_filter: bevy_render::texture::ImageFilterMode::Linear,
mipmap_filter: bevy_render::texture::ImageFilterMode::Linear,
..default()
});
Image::from_buffer(
bytes,
image_type,

View file

@ -9,7 +9,7 @@ use bevy_time::{Real, Time};
pub struct FrameTimeDiagnosticsPlugin;
impl Plugin for FrameTimeDiagnosticsPlugin {
fn build(&self, app: &mut bevy_app::App) {
fn build(&self, app: &mut App) {
app.register_diagnostic(
Diagnostic::new(Self::FRAME_TIME, "frame_time", 20).with_suffix("ms"),
)

View file

@ -27,14 +27,14 @@ pub(crate) fn item_struct(
);
match fields {
syn::Fields::Named(_) => quote! {
Fields::Named(_) => quote! {
#derive_macro_call
#item_attrs
#visibility struct #item_struct_name #user_impl_generics_with_world #user_where_clauses_with_world {
#(#(#field_attrs)* #field_visibilities #field_idents: <#field_types as #path::query::WorldQuery>::Item<'__w>,)*
}
},
syn::Fields::Unnamed(_) => quote! {
Fields::Unnamed(_) => quote! {
#derive_macro_call
#item_attrs
#[automatically_derived]
@ -42,7 +42,7 @@ pub(crate) fn item_struct(
#( #field_visibilities <#field_types as #path::query::WorldQuery>::Item<'__w>, )*
);
},
syn::Fields::Unit => quote! {
Fields::Unit => quote! {
#item_attrs
#visibility type #item_struct_name #user_ty_generics_with_world = #struct_name #user_ty_generics;
},

View file

@ -19,7 +19,7 @@ use crate::{
struct WorldQueryDataAttributes {
pub is_mutable: bool,
pub derive_args: Punctuated<syn::Meta, syn::token::Comma>,
pub derive_args: Punctuated<Meta, syn::token::Comma>,
}
static MUTABLE_ATTRIBUTE_NAME: &str = "mutable";
@ -57,7 +57,7 @@ pub fn derive_world_query_data_impl(input: TokenStream) -> TokenStream {
)
});
if ident == MUTABLE_ATTRIBUTE_NAME {
if let syn::Meta::Path(_) = meta {
if let Meta::Path(_) = meta {
attributes.is_mutable = true;
} else {
panic!(
@ -66,7 +66,7 @@ pub fn derive_world_query_data_impl(input: TokenStream) -> TokenStream {
}
}
else if ident == DERIVE_ATTRIBUTE_NAME {
if let syn::Meta::List(meta_list) = meta {
if let Meta::List(meta_list) = meta {
meta_list.parse_nested_meta(|meta| {
attributes.derive_args.push(Meta::Path(meta.path));
Ok(())

View file

@ -69,7 +69,7 @@ impl ArchetypeRow {
/// [`EMPTY`] which is guaranteed to be identical for all Worlds.
///
/// [`World`]: crate::world::World
/// [`EMPTY`]: crate::archetype::ArchetypeId::EMPTY
/// [`EMPTY`]: ArchetypeId::EMPTY
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
// SAFETY: Must be repr(transparent) due to the safety requirements on EntityLocation
#[repr(transparent)]

View file

@ -269,8 +269,8 @@ impl ComponentInfo {
/// [`World`].
///
/// Each time a new `Component` type is registered within a `World` using
/// [`World::init_component`](crate::world::World::init_component) or
/// [`World::init_component_with_descriptor`](crate::world::World::init_component_with_descriptor),
/// [`World::init_component`](World::init_component) or
/// [`World::init_component_with_descriptor`](World::init_component_with_descriptor),
/// a corresponding `ComponentId` is created to track it.
///
/// While the distinction between `ComponentId` and [`TypeId`] may seem superficial, breaking them
@ -682,7 +682,7 @@ pub struct Tick {
impl Tick {
/// The maximum relative age for a change tick.
/// The value of this is equal to [`crate::change_detection::MAX_CHANGE_AGE`].
/// The value of this is equal to [`MAX_CHANGE_AGE`].
///
/// Since change detection will not work for any ticks older than this,
/// ticks are periodically scanned to ensure their relative values are below this.

View file

@ -30,7 +30,6 @@ use bevy_utils::EntityHashMap;
/// }
/// ```
///
/// [`World`]: crate::world::World
pub trait MapEntities {
/// Updates all [`Entity`] references stored inside using `entity_mapper`.
///

View file

@ -327,7 +327,6 @@ impl SparseSetIndex for Entity {
}
/// An [`Iterator`] returning a sequence of [`Entity`] values from
/// [`Entities::reserve_entities`](crate::entity::Entities::reserve_entities).
pub struct ReserveEntitiesIterator<'a> {
// Metas, so we can recover the current generation for anything in the freelist.
meta: &'a [EntityMeta],
@ -363,7 +362,7 @@ impl<'a> Iterator for ReserveEntitiesIterator<'a> {
}
}
impl<'a> core::iter::ExactSizeIterator for ReserveEntitiesIterator<'a> {}
impl<'a> ExactSizeIterator for ReserveEntitiesIterator<'a> {}
impl<'a> core::iter::FusedIterator for ReserveEntitiesIterator<'a> {}
/// A [`World`]'s internal metadata store on all of its entities.

View file

@ -346,7 +346,7 @@ impl<E: Event> Events<E> {
}
}
impl<E: Event> std::iter::Extend<E> for Events<E> {
impl<E: Event> Extend<E> for Events<E> {
fn extend<I>(&mut self, iter: I)
where
I: IntoIterator<Item = E>,

View file

@ -1589,7 +1589,7 @@ mod tests {
fn ignored_system(_: Query<IgnoredQuery<()>>) {}
crate::system::assert_is_system(ignored_system);
assert_is_system(ignored_system);
}
// Ensures that each field of a `WorldQuery` struct's read-only variant
@ -1614,7 +1614,7 @@ mod tests {
}
}
crate::system::assert_is_system(my_system);
assert_is_system(my_system);
}
// Ensures that metadata types generated by the WorldQuery macro
@ -1642,6 +1642,6 @@ mod tests {
fn client_system(_: Query<Client<C>>) {}
crate::system::assert_is_system(client_system);
assert_is_system(client_system);
}
}

View file

@ -67,15 +67,11 @@ use std::{cell::UnsafeCell, marker::PhantomData};
/// ```
///
/// [`fetch`]: Self::fetch
/// [`Changed`]: crate::query::Changed
/// [`matches_component_set`]: Self::matches_component_set
/// [`Or`]: crate::query::Or
/// [`Query`]: crate::system::Query
/// [`State`]: Self::State
/// [`update_archetype_component_access`]: Self::update_archetype_component_access
/// [`update_component_access`]: Self::update_component_access
/// [`With`]: crate::query::With
/// [`Without`]: crate::query::Without
pub trait WorldQueryFilter: WorldQuery {
/// Returns true if (and only if) this Filter relies strictly on archetypes to limit which

View file

@ -43,7 +43,7 @@ pub struct QueryState<Q: WorldQueryData, F: WorldQueryFilter = ()> {
par_iter_span: Span,
}
impl<Q: WorldQueryData, F: WorldQueryFilter> std::fmt::Debug for QueryState<Q, F> {
impl<Q: WorldQueryData, F: WorldQueryFilter> fmt::Debug for QueryState<Q, F> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("QueryState")
.field("world_id", &self.world_id)

View file

@ -45,12 +45,12 @@ pub unsafe trait WorldQuery {
/// or a tuple of such things.
type Item<'a>;
/// Per archetype/table state used by this [`WorldQuery`] to fetch [`Self::Item`](crate::query::WorldQuery::Item)
/// Per archetype/table state used by this [`WorldQuery`] to fetch [`Self::Item`](WorldQuery::Item)
type Fetch<'a>: Clone;
/// State used to construct a [`Self::Fetch`](crate::query::WorldQuery::Fetch). This will be cached inside [`QueryState`](crate::query::QueryState),
/// State used to construct a [`Self::Fetch`](WorldQuery::Fetch). This will be cached inside [`QueryState`](crate::query::QueryState),
/// so it is best to move as much data / computation here as possible to reduce the cost of
/// constructing [`Self::Fetch`](crate::query::WorldQuery::Fetch).
/// constructing [`Self::Fetch`](WorldQuery::Fetch).
type State: Send + Sync + Sized;
/// This function manually implements subtyping for the query items.

View file

@ -54,7 +54,7 @@ impl ReflectBundle {
(self.0.from_world)(world)
}
/// Insert a reflected [`Bundle`] into the entity like [`insert()`](crate::world::EntityWorldMut::insert).
/// Insert a reflected [`Bundle`] into the entity like [`insert()`](EntityWorldMut::insert).
pub fn insert(&self, entity: &mut EntityWorldMut, bundle: &dyn Reflect) {
(self.0.insert)(entity, bundle);
}
@ -118,7 +118,6 @@ impl ReflectBundle {
/// and copy the subset of function pointers you care about.
///
/// [`TypeRegistration::data::<ReflectBundle>`]: bevy_reflect::TypeRegistration::data
/// [`TypeRegistry::get`]: bevy_reflect::TypeRegistry::get
pub fn fn_pointers(&self) -> &ReflectBundleFns {
&self.0
}

View file

@ -125,7 +125,7 @@ impl ReflectComponent {
(self.0.from_world)(world)
}
/// Insert a reflected [`Component`] into the entity like [`insert()`](crate::world::EntityWorldMut::insert).
/// Insert a reflected [`Component`] into the entity like [`insert()`](EntityWorldMut::insert).
pub fn insert(&self, entity: &mut EntityWorldMut, component: &dyn Reflect) {
(self.0.insert)(entity, component);
}

View file

@ -110,10 +110,10 @@ impl RemovedComponentEvents {
///
/// If you are using `bevy_ecs` as a standalone crate,
/// note that the `RemovedComponents` list will not be automatically cleared for you,
/// and will need to be manually flushed using [`World::clear_trackers`](crate::world::World::clear_trackers)
/// and will need to be manually flushed using [`World::clear_trackers`](World::clear_trackers)
///
/// For users of `bevy` and `bevy_app`, this is automatically done in `bevy_app::App::update`.
/// For the main world, [`World::clear_trackers`](crate::world::World::clear_trackers) is run after the main schedule is run and after
/// For the main world, [`World::clear_trackers`](World::clear_trackers) is run after the main schedule is run and after
/// `SubApp`'s have run.
///
/// # Examples

View file

@ -10,7 +10,7 @@ pub type BoxedCondition<In = ()> = Box<dyn ReadOnlySystem<In = In, Out = bool>>;
/// A system that determines if one or more scheduled systems should run.
///
/// Implemented for functions and closures that convert into [`System<Out=bool>`](crate::system::System)
/// Implemented for functions and closures that convert into [`System<Out=bool>`](System)
/// with [read-only](crate::system::ReadOnlySystemParam) parameters.
///
/// # Marker type parameter

View file

@ -683,7 +683,7 @@ fn apply_deferred(
unapplied_systems: &FixedBitSet,
systems: &[SyncUnsafeCell<BoxedSystem>],
world: &mut World,
) -> Result<(), Box<dyn std::any::Any + Send>> {
) -> Result<(), Box<dyn Any + Send>> {
for system_index in unapplied_systems.ones() {
// SAFETY: none of these systems are running, no other references exist
let system = unsafe { &mut *systems[system_index].get() };

View file

@ -152,7 +152,7 @@ where
map.insert(node, i);
topsorted.add_node(node);
// insert nodes as successors to their predecessors
for pred in graph.neighbors_directed(node, Direction::Incoming) {
for pred in graph.neighbors_directed(node, Incoming) {
topsorted.add_edge(pred, node, ());
}
}
@ -177,7 +177,7 @@ where
for a in topsorted.nodes().rev() {
let index_a = *map.get(&a).unwrap();
// iterate their successors in topological order
for b in topsorted.neighbors_directed(a, Direction::Outgoing) {
for b in topsorted.neighbors_directed(a, Outgoing) {
let index_b = *map.get(&b).unwrap();
debug_assert!(index_a < index_b);
if !visited[index_b] {
@ -187,7 +187,7 @@ where
reachable.insert(index(index_a, index_b, n));
let successors = transitive_closure
.neighbors_directed(b, Direction::Outgoing)
.neighbors_directed(b, Outgoing)
.collect::<Vec<_>>();
for c in successors {
let index_c = *map.get(&c).unwrap();

View file

@ -276,7 +276,7 @@ impl Schedule {
/// Runs all systems in this schedule on the `world`, using its current execution strategy.
pub fn run(&mut self, world: &mut World) {
#[cfg(feature = "trace")]
let _span = bevy_utils::tracing::info_span!("schedule", name = ?self.name).entered();
let _span = info_span!("schedule", name = ?self.name).entered();
world.check_change_ticks();
self.initialize(world)
@ -989,7 +989,7 @@ impl ScheduleGraph {
let mut systems = Vec::new();
let mut system_bitset = FixedBitSet::with_capacity(self.systems.len());
for child in hierarchy_graph.neighbors_directed(id, Direction::Outgoing) {
for child in hierarchy_graph.neighbors_directed(id, Outgoing) {
match child {
NodeId::System(_) => {
systems.push(child);
@ -1020,19 +1020,19 @@ impl ScheduleGraph {
let mut temp = Vec::new();
for (&set, systems) in set_systems {
if systems.is_empty() {
for a in dependency_flattened.neighbors_directed(set, Direction::Incoming) {
for b in dependency_flattened.neighbors_directed(set, Direction::Outgoing) {
for a in dependency_flattened.neighbors_directed(set, Incoming) {
for b in dependency_flattened.neighbors_directed(set, Outgoing) {
temp.push((a, b));
}
}
} else {
for a in dependency_flattened.neighbors_directed(set, Direction::Incoming) {
for a in dependency_flattened.neighbors_directed(set, Incoming) {
for &sys in systems {
temp.push((a, sys));
}
}
for b in dependency_flattened.neighbors_directed(set, Direction::Outgoing) {
for b in dependency_flattened.neighbors_directed(set, Outgoing) {
for &sys in systems {
temp.push((sys, b));
}
@ -1166,12 +1166,12 @@ impl ScheduleGraph {
for &sys_id in &dg_system_ids {
let num_dependencies = dependency_flattened_dag
.graph
.neighbors_directed(sys_id, Direction::Incoming)
.neighbors_directed(sys_id, Incoming)
.count();
let dependents = dependency_flattened_dag
.graph
.neighbors_directed(sys_id, Direction::Outgoing)
.neighbors_directed(sys_id, Outgoing)
.map(|dep_id| dg_system_idx_map[&dep_id])
.collect::<Vec<_>>();
@ -1348,7 +1348,7 @@ impl ScheduleGraph {
"({})",
self.hierarchy
.graph
.edges_directed(*id, Direction::Outgoing)
.edges_directed(*id, Outgoing)
// never get the sets of the members or this will infinite recurse when the report_sets setting is on.
.map(|(_, member_id, _)| self.get_node_name_inner(&member_id, false))
.reduce(|a, b| format!("{a}, {b}"))
@ -1556,14 +1556,8 @@ impl ScheduleGraph {
if set.is_system_type() {
let instances = systems.len();
let ambiguous_with = self.ambiguous_with.edges(id);
let before = self
.dependency
.graph
.edges_directed(id, Direction::Incoming);
let after = self
.dependency
.graph
.edges_directed(id, Direction::Outgoing);
let before = self.dependency.graph.edges_directed(id, Incoming);
let after = self.dependency.graph.edges_directed(id, Outgoing);
let relations = before.count() + after.count() + ambiguous_with.count();
if instances > 1 && relations > 0 {
return Err(ScheduleBuildError::SystemTypeSetAmbiguity(
@ -1649,7 +1643,7 @@ impl ScheduleGraph {
}
fn traverse_sets_containing_node(&self, id: NodeId, f: &mut impl FnMut(NodeId) -> bool) {
for (set_id, _, _) in self.hierarchy.graph.edges_directed(id, Direction::Incoming) {
for (set_id, _, _) in self.hierarchy.graph.edges_directed(id, Incoming) {
if f(set_id) {
self.traverse_sets_containing_node(set_id, f);
}

View file

@ -109,7 +109,7 @@ impl<T> SystemSet for SystemTypeSet<T> {
}
fn dyn_hash(&self, mut state: &mut dyn Hasher) {
std::any::TypeId::of::<Self>().hash(&mut state);
TypeId::of::<Self>().hash(&mut state);
self.hash(&mut state);
}
}
@ -136,7 +136,7 @@ impl SystemSet for AnonymousSet {
}
fn dyn_hash(&self, mut state: &mut dyn Hasher) {
std::any::TypeId::of::<Self>().hash(&mut state);
TypeId::of::<Self>().hash(&mut state);
self.hash(&mut state);
}

View file

@ -51,7 +51,6 @@ impl BlobVec {
/// If `drop` is `None`, the items will be leaked. This should generally be set as None based on [`needs_drop`].
///
/// [`needs_drop`]: core::mem::needs_drop
/// [`Drop`]: core::ops::Drop
pub unsafe fn new(
item_layout: Layout,
drop: Option<unsafe fn(OwningPtr<'_>)>,

View file

@ -72,7 +72,6 @@ impl TableId {
/// [`Archetype`]: crate::archetype::Archetype
/// [`Archetype::entity_table_row`]: crate::archetype::Archetype::entity_table_row
/// [`Archetype::table_id`]: crate::archetype::Archetype::table_id
/// [`Entity`]: crate::entity::Entity
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
// SAFETY: Must be repr(transparent) due to the safety requirements on EntityLocation
#[repr(transparent)]
@ -192,7 +191,6 @@ impl Column {
/// # Safety
/// `row` must be within the range `[0, self.len())`.
///
/// [`Drop`]: std::ops::Drop
#[inline]
pub(crate) unsafe fn swap_remove_unchecked(&mut self, row: TableRow) {
self.data.swap_remove_and_drop_unchecked(row.index());
@ -311,8 +309,6 @@ impl Column {
///
/// # Safety
/// The type `T` must be the type of the items in this column.
///
/// [`UnsafeCell`]: std::cell::UnsafeCell
pub unsafe fn get_data_slice<T>(&self) -> &[UnsafeCell<T>] {
self.data.get_slice()
}
@ -322,8 +318,6 @@ impl Column {
/// Note: The values stored within are [`UnsafeCell`].
/// Users of this API must ensure that accesses to each individual element
/// adhere to the safety invariants of [`UnsafeCell`].
///
/// [`UnsafeCell`]: std::cell::UnsafeCell
#[inline]
pub fn get_added_ticks_slice(&self) -> &[UnsafeCell<Tick>] {
&self.added_ticks
@ -334,8 +328,6 @@ impl Column {
/// Note: The values stored within are [`UnsafeCell`].
/// Users of this API must ensure that accesses to each individual element
/// adhere to the safety invariants of [`UnsafeCell`].
///
/// [`UnsafeCell`]: std::cell::UnsafeCell
#[inline]
pub fn get_changed_ticks_slice(&self) -> &[UnsafeCell<Tick>] {
&self.changed_ticks
@ -411,8 +403,6 @@ impl Column {
/// Note: The values stored within are [`UnsafeCell`].
/// Users of this API must ensure that accesses to each individual element
/// adhere to the safety invariants of [`UnsafeCell`].
///
/// [`UnsafeCell`]: std::cell::UnsafeCell
#[inline]
pub fn get_added_tick(&self, row: TableRow) -> Option<&UnsafeCell<Tick>> {
self.added_ticks.get(row.index())
@ -425,8 +415,6 @@ impl Column {
/// Note: The values stored within are [`UnsafeCell`].
/// Users of this API must ensure that accesses to each individual element
/// adhere to the safety invariants of [`UnsafeCell`].
///
/// [`UnsafeCell`]: std::cell::UnsafeCell
#[inline]
pub fn get_changed_tick(&self, row: TableRow) -> Option<&UnsafeCell<Tick>> {
self.changed_ticks.get(row.index())

View file

@ -527,7 +527,7 @@ impl<'w, 's> Commands<'w, 's> {
/// Systems are ran in an exclusive and single threaded way.
/// Running slow systems can become a bottleneck.
///
/// Calls [`World::run_system`](crate::system::World::run_system).
/// Calls [`World::run_system`](World::run_system).
///
/// There is no way to get the output of a system when run as a command, because the
/// execution of the system happens later. To get the output of a system, use
@ -540,7 +540,7 @@ impl<'w, 's> Commands<'w, 's> {
/// Systems are ran in an exclusive and single threaded way.
/// Running slow systems can become a bottleneck.
///
/// Calls [`World::run_system_with_input`](crate::system::World::run_system_with_input).
/// Calls [`World::run_system_with_input`](World::run_system_with_input).
///
/// There is no way to get the output of a system when run as a command, because the
/// execution of the system happens later. To get the output of a system, use
@ -812,7 +812,7 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
/// Removes a [`Bundle`] of components from the entity.
///
/// See [`EntityWorldMut::remove`](crate::world::EntityWorldMut::remove) for more
/// See [`EntityWorldMut::remove`](EntityWorldMut::remove) for more
/// details.
///
/// # Example

View file

@ -75,7 +75,7 @@ impl SystemMeta {
///
/// This is a powerful and convenient tool for working with exclusive world access,
/// allowing you to fetch data from the [`World`] as if you were running a [`System`].
/// However, simply calling `world::run_system(my_system)` using a [`World::run_system`](crate::system::World::run_system)
/// However, simply calling `world::run_system(my_system)` using a [`World::run_system`](World::run_system)
/// can be significantly simpler and ensures that change detection and command flushing work as expected.
///
/// Borrow-checking is handled for you, allowing you to mutably access multiple compatible system parameters at once,
@ -92,7 +92,7 @@ impl SystemMeta {
/// - [`Local`](crate::system::Local) variables that hold state
/// - [`EventReader`](crate::event::EventReader) system parameters, which rely on a [`Local`](crate::system::Local) to track which events have been seen
///
/// Note that this is automatically handled for you when using a [`World::run_system`](crate::system::World::run_system).
/// Note that this is automatically handled for you when using a [`World::run_system`](World::run_system).
///
/// # Example
///

View file

@ -91,7 +91,6 @@
//! - [`EventWriter`](crate::event::EventWriter)
//! - [`NonSend`] and `Option<NonSend>`
//! - [`NonSendMut`] and `Option<NonSendMut>`
//! - [`&World`](crate::world::World)
//! - [`RemovedComponents`](crate::removal_detection::RemovedComponents)
//! - [`SystemName`]
//! - [`SystemChangeTick`]
@ -174,7 +173,7 @@ pub trait IntoSystem<In, Out, Marker>: Sized {
/// # use bevy_ecs::prelude::*;
/// # let mut schedule = Schedule::default();
/// // Ignores the output of a system that may fail.
/// schedule.add_systems(my_system.map(std::mem::drop));
/// schedule.add_systems(my_system.map(drop));
/// # let mut world = World::new();
/// # world.insert_resource(T);
/// # schedule.run(&mut world);
@ -1015,7 +1014,7 @@ mod tests {
let archetype = archetypes.get(location.archetype_id).unwrap();
let archetype_components = archetype.components().collect::<Vec<_>>();
let bundle_id = bundles
.get_id(std::any::TypeId::of::<(W<i32>, W<bool>)>())
.get_id(TypeId::of::<(W<i32>, W<bool>)>())
.expect("Bundle used to spawn entity should exist");
let bundle_info = bundles.get(bundle_id).unwrap();
let mut bundle_components = bundle_info.components().to_vec();
@ -1608,7 +1607,7 @@ mod tests {
}
assert_is_system(returning::<Result<u32, std::io::Error>>.map(Result::unwrap));
assert_is_system(returning::<Option<()>>.map(std::mem::drop));
assert_is_system(returning::<Option<()>>.map(drop));
assert_is_system(returning::<&str>.map(u64::from_str).map(Result::unwrap));
assert_is_system(exclusive_in_out::<(), Result<(), std::io::Error>>.map(bevy_utils::error));
assert_is_system(returning::<bool>.pipe(exclusive_in_out::<bool, ()>));

View file

@ -155,7 +155,7 @@ use std::{any::TypeId, borrow::Borrow};
/// enemy_query: Query<&mut Health, With<Enemy>>,
/// )
/// # {}
/// # let mut randomize_health_system = bevy_ecs::system::IntoSystem::into_system(randomize_health);
/// # let mut randomize_health_system = IntoSystem::into_system(randomize_health);
/// # let mut world = World::new();
/// # randomize_health_system.initialize(&mut world);
/// # randomize_health_system.run((), &mut world);
@ -178,7 +178,7 @@ use std::{any::TypeId, borrow::Borrow};
/// enemy_query: Query<&mut Health, (With<Enemy>, Without<Player>)>,
/// )
/// # {}
/// # let mut randomize_health_system = bevy_ecs::system::IntoSystem::into_system(randomize_health);
/// # let mut randomize_health_system = IntoSystem::into_system(randomize_health);
/// # let mut world = World::new();
/// # randomize_health_system.initialize(&mut world);
/// # randomize_health_system.run((), &mut world);
@ -296,7 +296,7 @@ use std::{any::TypeId, borrow::Borrow};
/// [binomial coefficient]: https://en.wikipedia.org/wiki/Binomial_coefficient
/// [`Changed`]: crate::query::Changed
/// [components]: crate::component::Component
/// [entity identifiers]: crate::entity::Entity
/// [entity identifiers]: Entity
/// [`EntityRef`]: crate::world::EntityRef
/// [`for_each`]: Self::for_each
/// [`for_each_mut`]: Self::for_each_mut

View file

@ -166,8 +166,8 @@ impl<In: 'static, Out: 'static> Debug for dyn System<In = In, Out = Out> {
/// This function is not an efficient method of running systems and its meant to be used as a utility
/// for testing and/or diagnostics.
///
/// Systems called through [`run_system_once`](crate::system::RunSystemOnce::run_system_once) do not hold onto any state,
/// as they are created and destroyed every time [`run_system_once`](crate::system::RunSystemOnce::run_system_once) is called.
/// Systems called through [`run_system_once`](RunSystemOnce::run_system_once) do not hold onto any state,
/// as they are created and destroyed every time [`run_system_once`](RunSystemOnce::run_system_once) is called.
/// Practically, this means that [`Local`](crate::system::Local) variables are
/// reset on every run and change detection does not work.
///
@ -187,7 +187,7 @@ impl<In: 'static, Out: 'static> Debug for dyn System<In = In, Out = Out> {
/// world.run_system_once(increment); // still prints 1
/// ```
///
/// If you do need systems to hold onto state between runs, use the [`World::run_system`](crate::system::World::run_system)
/// If you do need systems to hold onto state between runs, use the [`World::run_system`](World::run_system)
/// and run the system by their [`SystemId`](crate::system::SystemId).
///
/// # Usage

View file

@ -260,7 +260,7 @@ fn assert_component_access_compatibility(
/// // ...
/// }
/// #
/// # let mut bad_system_system = bevy_ecs::system::IntoSystem::into_system(bad_system);
/// # let mut bad_system_system = IntoSystem::into_system(bad_system);
/// # let mut world = World::new();
/// # bad_system_system.initialize(&mut world);
/// # bad_system_system.run((), &mut world);
@ -403,7 +403,6 @@ impl_param_set!();
/// }
/// ```
///
/// [`SyncCell`]: bevy_utils::synccell::SyncCell
/// [`Exclusive`]: https://doc.rust-lang.org/nightly/std/sync/struct.Exclusive.html
pub trait Resource: Send + Sync + 'static {}
@ -1245,7 +1244,7 @@ unsafe impl<'a> SystemParam for &'a Bundles {
///
/// Component change ticks that are more recent than `last_run` will be detected by the system.
/// Those can be read by calling [`last_changed`](crate::change_detection::DetectChanges::last_changed)
/// on a [`Mut<T>`](crate::change_detection::Mut) or [`ResMut<T>`](crate::change_detection::ResMut).
/// on a [`Mut<T>`](crate::change_detection::Mut) or [`ResMut<T>`](ResMut).
#[derive(Debug)]
pub struct SystemChangeTick {
last_run: Tick,

View file

@ -322,7 +322,7 @@ pub struct RunSystemWithInput<I: 'static> {
/// Running slow systems can become a bottleneck.
///
/// If the system needs an [`In<_>`](crate::system::In) input value to run, use the
/// [`crate::system::RunSystemWithInput`] type instead.
/// [`RunSystemWithInput`] type instead.
///
/// There is no way to get the output of a system when run as a command, because the
/// execution of the system happens later. To get the output of a system, use

View file

@ -53,7 +53,7 @@ unsafe impl SystemParam for WorldId {
type Item<'world, 'state> = WorldId;
fn init_state(_: &mut super::World, _: &mut crate::system::SystemMeta) -> Self::State {}
fn init_state(_: &mut World, _: &mut crate::system::SystemMeta) -> Self::State {}
unsafe fn get_param<'world, 'state>(
_: &'state mut Self::State,

View file

@ -1799,7 +1799,7 @@ impl World {
resources.check_change_ticks(change_tick);
non_send_resources.check_change_ticks(change_tick);
if let Some(mut schedules) = self.get_resource_mut::<crate::schedule::Schedules>() {
if let Some(mut schedules) = self.get_resource_mut::<Schedules>() {
schedules.check_change_ticks(change_tick);
}
@ -2293,7 +2293,7 @@ mod tests {
world.insert_resource(TestResource(42));
let component_id = world
.components()
.get_resource_id(std::any::TypeId::of::<TestResource>())
.get_resource_id(TypeId::of::<TestResource>())
.unwrap();
let resource = world.get_resource_by_id(component_id).unwrap();
@ -2309,7 +2309,7 @@ mod tests {
world.insert_resource(TestResource(42));
let component_id = world
.components()
.get_resource_id(std::any::TypeId::of::<TestResource>())
.get_resource_id(TypeId::of::<TestResource>())
.unwrap();
{
@ -2342,7 +2342,7 @@ mod tests {
Some(|ptr| {
let data = ptr.read::<[u8; 8]>();
assert_eq!(data, [0, 1, 2, 3, 4, 5, 6, 7]);
DROP_COUNT.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
DROP_COUNT.fetch_add(1, Ordering::SeqCst);
}),
)
};
@ -2368,7 +2368,7 @@ mod tests {
assert!(world.remove_resource_by_id(component_id).is_some());
assert_eq!(DROP_COUNT.load(std::sync::atomic::Ordering::SeqCst), 1);
assert_eq!(DROP_COUNT.load(Ordering::SeqCst), 1);
}
#[derive(Resource)]

View file

@ -144,7 +144,7 @@ impl<'w> UnsafeWorldCell<'w> {
unsafe { &mut *self.0 }
}
/// Gets a reference to the [`&World`](crate::world::World) this [`UnsafeWorldCell`] belongs to.
/// Gets a reference to the [`&World`](World) this [`UnsafeWorldCell`] belongs to.
/// This can be used for arbitrary shared/readonly access.
///
/// # Safety

View file

@ -53,7 +53,7 @@ fn get_base_effects(
strong_motor,
}: GamepadRumbleIntensity,
duration: Duration,
) -> Vec<ff::BaseEffect> {
) -> Vec<BaseEffect> {
let mut effects = Vec::new();
if strong_motor > 0. {
effects.push(BaseEffect {

View file

@ -186,8 +186,8 @@ async fn load_gltf<'a, 'b, 'c>(
let reader = channel.reader(|buffer| Some(&buffer_data[buffer.index()]));
let keyframe_timestamps: Vec<f32> = if let Some(inputs) = reader.read_inputs() {
match inputs {
gltf::accessor::Iter::Standard(times) => times.collect(),
gltf::accessor::Iter::Sparse(_) => {
Iter::Standard(times) => times.collect(),
Iter::Sparse(_) => {
warn!("Sparse accessor not supported for animation sampler input");
continue;
}
@ -439,7 +439,7 @@ async fn load_gltf<'a, 'b, 'c>(
"Missing vertex tangents, computing them using the mikktspace algorithm"
);
if let Err(err) = mesh.generate_tangents() {
bevy_log::warn!(
warn!(
"Failed to generate vertex tangents using the mikktspace algorithm: {:?}",
err
);
@ -485,7 +485,7 @@ async fn load_gltf<'a, 'b, 'c>(
.and_then(|i| meshes.get(i).cloned()),
transform: match node.transform() {
gltf::scene::Transform::Matrix { matrix } => {
Transform::from_matrix(bevy_math::Mat4::from_cols_array_2d(&matrix))
Transform::from_matrix(Mat4::from_cols_array_2d(&matrix))
}
gltf::scene::Transform::Decomposed {
translation,
@ -510,7 +510,7 @@ async fn load_gltf<'a, 'b, 'c>(
let nodes = resolve_node_hierarchy(nodes_intermediate, load_context.path())
.into_iter()
.map(|(label, node)| load_context.add_labeled_asset(label, node))
.collect::<Vec<bevy_asset::Handle<GltfNode>>>();
.collect::<Vec<Handle<GltfNode>>>();
let named_nodes = named_nodes_intermediate
.into_iter()
.filter_map(|(name, index)| {
@ -637,7 +637,7 @@ async fn load_gltf<'a, 'b, 'c>(
}
fn get_gltf_extras(extras: &gltf::json::Extras) -> Option<GltfExtras> {
extras.as_ref().map(|extras| super::GltfExtras {
extras.as_ref().map(|extras| GltfExtras {
value: extras.get().to_string(),
})
}
@ -856,7 +856,7 @@ fn load_material(
/// Loads a glTF node.
#[allow(clippy::too_many_arguments)]
fn load_node(
gltf_node: &gltf::Node,
gltf_node: &Node,
world_builder: &mut WorldChildBuilder,
root_load_context: &LoadContext,
load_context: &mut LoadContext,
@ -881,7 +881,7 @@ fn load_node(
node.insert(node_name(gltf_node));
if let Some(extras) = gltf_node.extras() {
node.insert(super::GltfExtras {
node.insert(GltfExtras {
value: extras.get().to_string(),
});
}
@ -985,7 +985,7 @@ fn load_node(
));
if let Some(extras) = primitive.extras() {
mesh_entity.insert(super::GltfExtras {
mesh_entity.insert(GltfExtras {
value: extras.get().to_string(),
});
}
@ -1015,7 +1015,7 @@ fn load_node(
entity.insert(Name::new(name.to_string()));
}
if let Some(extras) = light.extras() {
entity.insert(super::GltfExtras {
entity.insert(GltfExtras {
value: extras.get().to_string(),
});
}
@ -1038,7 +1038,7 @@ fn load_node(
entity.insert(Name::new(name.to_string()));
}
if let Some(extras) = light.extras() {
entity.insert(super::GltfExtras {
entity.insert(GltfExtras {
value: extras.get().to_string(),
});
}
@ -1066,7 +1066,7 @@ fn load_node(
entity.insert(Name::new(name.to_string()));
}
if let Some(extras) = light.extras() {
entity.insert(super::GltfExtras {
entity.insert(GltfExtras {
value: extras.get().to_string(),
});
}
@ -1134,7 +1134,7 @@ fn morph_targets_label(mesh: &gltf::Mesh, primitive: &Primitive) -> String {
}
/// Returns the label for the `material`.
fn material_label(material: &gltf::Material, is_scale_inverted: bool) -> String {
fn material_label(material: &Material, is_scale_inverted: bool) -> String {
if let Some(index) = material.index() {
format!(
"Material{index}{}",
@ -1174,7 +1174,7 @@ fn texture_handle(load_context: &mut LoadContext, texture: &gltf::Texture) -> Ha
}
/// Returns the label for the `node`.
fn node_label(node: &gltf::Node) -> String {
fn node_label(node: &Node) -> String {
format!("Node{}", node.index())
}
@ -1233,7 +1233,7 @@ fn texture_sampler(texture: &gltf::Texture) -> ImageSamplerDescriptor {
}
/// Maps the texture address mode form glTF to wgpu.
fn texture_address_mode(gltf_address_mode: &gltf::texture::WrappingMode) -> ImageAddressMode {
fn texture_address_mode(gltf_address_mode: &WrappingMode) -> ImageAddressMode {
match gltf_address_mode {
WrappingMode::ClampToEdge => ImageAddressMode::ClampToEdge,
WrappingMode::Repeat => ImageAddressMode::Repeat,

View file

@ -20,7 +20,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
/// ## Usage
///
/// The event is consumed inside of the [`keyboard_input_system`]
/// to update the [`Input<KeyCode>`](crate::Input<KeyCode>) resource.
/// to update the [`Input<KeyCode>`](Input<KeyCode>) resource.
#[derive(Event, Debug, Clone, Copy, PartialEq, Eq, Reflect)]
#[reflect(Debug, PartialEq)]
#[cfg_attr(

View file

@ -20,7 +20,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
/// ## Usage
///
/// The event is read inside of the [`mouse_button_input_system`]
/// to update the [`Input<MouseButton>`](crate::Input<MouseButton>) resource.
/// to update the [`Input<MouseButton>`](Input<MouseButton>) resource.
#[derive(Event, Debug, Clone, Copy, PartialEq, Eq, Reflect)]
#[reflect(Debug, PartialEq)]
#[cfg_attr(

View file

@ -138,9 +138,9 @@ pub mod pbr {
#[cfg(feature = "bevy_render")]
pub mod render {
//! Cameras, meshes, textures, shaders, and pipelines.
//! Use [`RenderDevice::features`](crate::render::renderer::RenderDevice::features),
//! [`RenderDevice::limits`](crate::render::renderer::RenderDevice::limits), and the
//! [`RenderAdapterInfo`](crate::render::renderer::RenderAdapterInfo) resource to
//! Use [`RenderDevice::features`](renderer::RenderDevice::features),
//! [`RenderDevice::limits`](renderer::RenderDevice::limits), and the
//! [`RenderAdapterInfo`](renderer::RenderAdapterInfo) resource to
//! get runtime information about the actual adapter, backend, features, and limits.
pub use bevy_render::*;
}

View file

@ -36,21 +36,21 @@
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
/// Fully Qualified (FQ) short name for [`::core::any::Any`]
/// Fully Qualified (FQ) short name for [`core::any::Any`]
pub struct FQAny;
/// Fully Qualified (FQ) short name for [`::std::boxed::Box`]
/// Fully Qualified (FQ) short name for [`Box`]
pub struct FQBox;
/// Fully Qualified (FQ) short name for [`::core::clone::Clone`]
/// Fully Qualified (FQ) short name for [`Clone`]
pub struct FQClone;
/// Fully Qualified (FQ) short name for [`::core::default::Default`]
/// Fully Qualified (FQ) short name for [`Default`]
pub struct FQDefault;
/// Fully Qualified (FQ) short name for [`::core::option::Option`]
/// Fully Qualified (FQ) short name for [`Option`]
pub struct FQOption;
/// Fully Qualified (FQ) short name for [`::core::result::Result`]
/// Fully Qualified (FQ) short name for [`Result`]
pub struct FQResult;
/// Fully Qualified (FQ) short name for [`::core::marker::Send`]
/// Fully Qualified (FQ) short name for [`Send`]
pub struct FQSend;
/// Fully Qualified (FQ) short name for [`::core::marker::Sync`]
/// Fully Qualified (FQ) short name for [`Sync`]
pub struct FQSync;
impl ToTokens for FQAny {

View file

@ -3,7 +3,7 @@ use syn::{punctuated::Punctuated, token::Comma, Data, DataStruct, Error, Field,
/// Get the fields of a data structure if that structure is a struct with named fields;
/// otherwise, return a compile error that points to the site of the macro invocation.
pub fn get_struct_fields(data: &syn::Data) -> syn::Result<&Punctuated<Field, Comma>> {
pub fn get_struct_fields(data: &Data) -> syn::Result<&Punctuated<Field, Comma>> {
match data {
Data::Struct(DataStruct {
fields: Fields::Named(fields),

View file

@ -117,8 +117,7 @@ impl<B: Material, E: MaterialExtension> AsBindGroup for ExtendedMaterial<B, E> {
render_device: &RenderDevice,
images: &RenderAssets<Image>,
fallback_image: &FallbackImage,
) -> Result<bevy_render::render_resource::UnpreparedBindGroup<Self::Data>, AsBindGroupError>
{
) -> Result<UnpreparedBindGroup<Self::Data>, AsBindGroupError> {
// add together the bindings of the base material and the user material
let UnpreparedBindGroup {
mut bindings,
@ -154,42 +153,42 @@ impl<B: Material, E: MaterialExtension> AsBindGroup for ExtendedMaterial<B, E> {
}
impl<B: Material, E: MaterialExtension> Material for ExtendedMaterial<B, E> {
fn vertex_shader() -> bevy_render::render_resource::ShaderRef {
fn vertex_shader() -> ShaderRef {
match E::vertex_shader() {
ShaderRef::Default => B::vertex_shader(),
specified => specified,
}
}
fn fragment_shader() -> bevy_render::render_resource::ShaderRef {
fn fragment_shader() -> ShaderRef {
match E::fragment_shader() {
ShaderRef::Default => B::fragment_shader(),
specified => specified,
}
}
fn prepass_vertex_shader() -> bevy_render::render_resource::ShaderRef {
fn prepass_vertex_shader() -> ShaderRef {
match E::prepass_vertex_shader() {
ShaderRef::Default => B::prepass_vertex_shader(),
specified => specified,
}
}
fn prepass_fragment_shader() -> bevy_render::render_resource::ShaderRef {
fn prepass_fragment_shader() -> ShaderRef {
match E::prepass_fragment_shader() {
ShaderRef::Default => B::prepass_fragment_shader(),
specified => specified,
}
}
fn deferred_vertex_shader() -> bevy_render::render_resource::ShaderRef {
fn deferred_vertex_shader() -> ShaderRef {
match E::deferred_vertex_shader() {
ShaderRef::Default => B::deferred_vertex_shader(),
specified => specified,
}
}
fn deferred_fragment_shader() -> bevy_render::render_resource::ShaderRef {
fn deferred_fragment_shader() -> ShaderRef {
match E::deferred_fragment_shader() {
ShaderRef::Default => B::deferred_fragment_shader(),
specified => specified,

View file

@ -335,18 +335,15 @@ impl Plugin for PbrPlugin {
// Extract the required data from the main world
render_app
.add_systems(
ExtractSchedule,
(render::extract_clusters, render::extract_lights),
)
.add_systems(ExtractSchedule, (extract_clusters, extract_lights))
.add_systems(
Render,
(
render::prepare_lights
prepare_lights
.in_set(RenderSet::ManageViews)
.after(prepare_assets::<Image>),
sort_phase_system::<Shadow>.in_set(RenderSet::PhaseSort),
render::prepare_clusters.in_set(RenderSet::PrepareResources),
prepare_clusters.in_set(RenderSet::PrepareResources),
),
)
.init_resource::<LightMeta>();

View file

@ -85,7 +85,7 @@ impl Default for PointLightShadowMap {
/// A light that emits light in a given direction from a central point.
/// Behaves like a point light in a perfectly absorbent housing that
/// shines light only in a given direction. The direction is taken from
/// the transform, and can be specified with [`Transform::looking_at`](bevy_transform::components::Transform::looking_at).
/// the transform, and can be specified with [`Transform::looking_at`](Transform::looking_at).
#[derive(Component, Debug, Clone, Copy, Reflect)]
#[reflect(Component, Default)]
pub struct SpotLight {
@ -172,7 +172,7 @@ impl Default for SpotLight {
/// Shadows are produced via [cascaded shadow maps](https://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf).
///
/// To modify the cascade set up, such as the number of cascades or the maximum shadow distance,
/// change the [`CascadeShadowConfig`] component of the [`crate::bundle::DirectionalLightBundle`].
/// change the [`CascadeShadowConfig`] component of the [`DirectionalLightBundle`].
///
/// To control the resolution of the shadow maps, use the [`DirectionalLightShadowMap`] resource:
///

View file

@ -229,7 +229,7 @@ where
prepare_materials::<M>
.in_set(RenderSet::PrepareAssets)
.after(prepare_assets::<Image>),
render::queue_shadows::<M>
queue_shadows::<M>
.in_set(RenderSet::QueueMeshes)
.after(prepare_materials::<M>),
queue_material_meshes::<M>

View file

@ -58,7 +58,7 @@ impl<M: Material> Plugin for PrepassPipelinePlugin<M>
where
M::Data: PartialEq + Eq + Hash + Clone,
{
fn build(&self, app: &mut bevy_app::App) {
fn build(&self, app: &mut App) {
load_internal_asset!(
app,
PREPASS_SHADER_HANDLE,
@ -101,7 +101,7 @@ where
.init_resource::<PreviousViewProjectionUniforms>();
}
fn finish(&self, app: &mut bevy_app::App) {
fn finish(&self, app: &mut App) {
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
return;
};
@ -125,7 +125,7 @@ impl<M: Material> Plugin for PrepassPlugin<M>
where
M::Data: PartialEq + Eq + Hash + Clone,
{
fn build(&self, app: &mut bevy_app::App) {
fn build(&self, app: &mut App) {
let no_prepass_plugin_loaded = app.world.get_resource::<AnyPrepassPluginLoaded>().is_none();
if no_prepass_plugin_loaded {

View file

@ -75,7 +75,7 @@ pub const MORPH_HANDLE: Handle<Shader> = Handle::weak_from_u128(9709828135876073
pub const MESH_PIPELINE_VIEW_LAYOUT_SAFE_MAX_TEXTURES: usize = 10;
impl Plugin for MeshRenderPlugin {
fn build(&self, app: &mut bevy_app::App) {
fn build(&self, app: &mut App) {
load_internal_asset!(app, FORWARD_IO_HANDLE, "forward_io.wgsl", Shader::from_wgsl);
load_internal_asset!(
app,
@ -151,7 +151,7 @@ impl Plugin for MeshRenderPlugin {
}
}
fn finish(&self, app: &mut bevy_app::App) {
fn finish(&self, app: &mut App) {
let mut mesh_bindings_shader_defs = Vec::with_capacity(1);
if let Ok(render_app) = app.get_sub_app_mut(RenderApp) {

View file

@ -446,7 +446,7 @@ fn extract_bool(
mut mapper: impl FnMut(&LitBool) -> LitBool,
) -> Result<LitBool, syn::Error> {
match value {
syn::Expr::Lit(syn::ExprLit {
Expr::Lit(syn::ExprLit {
lit: syn::Lit::Bool(lit),
..
}) => Ok(mapper(lit)),

View file

@ -444,7 +444,7 @@ impl<'a> ReflectStruct<'a> {
/// Returns the `GetTypeRegistration` impl as a `TokenStream`.
///
/// Returns a specific implementation for structs and this method should be preferred over the generic [`get_type_registration`](crate::ReflectMeta) method
/// Returns a specific implementation for structs and this method should be preferred over the generic [`get_type_registration`](ReflectMeta) method
pub fn get_type_registration(
&self,
where_clause_options: &WhereClauseOptions,
@ -457,7 +457,7 @@ impl<'a> ReflectStruct<'a> {
}
/// Get a collection of types which are exposed to the reflection API
pub fn active_types(&self) -> Vec<syn::Type> {
pub fn active_types(&self) -> Vec<Type> {
self.active_fields()
.map(|field| field.data.ty.clone())
.collect()
@ -605,14 +605,14 @@ pub(crate) enum ReflectTypePath<'a> {
///
/// May have a separate alias path used for the `TypePath` implementation.
///
/// Module and crate are found with [`module_path!()`](core::module_path),
/// Module and crate are found with [`module_path!()`](module_path),
/// if there is no custom path specified.
Internal {
ident: &'a Ident,
custom_path: Option<Path>,
generics: &'a Generics,
},
/// Any [`syn::Type`] with only a defined `type_path` and `short_type_path`.
/// Any [`Type`] with only a defined `type_path` and `short_type_path`.
#[allow(dead_code)]
// Not currently used but may be useful in the future due to its generality.
Anonymous {

View file

@ -50,7 +50,7 @@ pub(crate) fn impl_struct(reflect_struct: &ReflectStruct) -> proc_macro2::TokenS
let field_generator = {
let docs = reflect_struct
.active_fields()
.map(|field| quote::ToTokens::to_token_stream(&field.doc));
.map(|field| ToTokens::to_token_stream(&field.doc));
quote! {
#(#bevy_reflect_path::NamedField::new::<#field_types>(#field_names).with_docs(#docs) ,)*
}

View file

@ -44,7 +44,7 @@ pub(crate) fn impl_tuple_struct(reflect_struct: &ReflectStruct) -> proc_macro2::
let field_generator = {
let docs = reflect_struct
.active_fields()
.map(|field| quote::ToTokens::to_token_stream(&field.doc));
.map(|field| ToTokens::to_token_stream(&field.doc));
quote! {
#(#bevy_reflect_path::UnnamedField::new::<#field_types>(#field_idents).with_docs(#docs) ,)*
}

View file

@ -380,7 +380,7 @@ impl<'a> ExactSizeIterator for ArrayIter<'a> {}
#[inline]
pub fn array_hash<A: Array>(array: &A) -> Option<u64> {
let mut hasher = reflect_hasher();
std::any::Any::type_id(array).hash(&mut hasher);
Any::type_id(array).hash(&mut hasher);
array.len().hash(&mut hasher);
for value in array.iter() {
hasher.write_u64(value.reflect_hash()?);

View file

@ -84,8 +84,8 @@ use std::slice::Iter;
///
/// [enum-like]: https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html
/// [reflection]: crate
/// [`None`]: core::option::Option<T>::None
/// [`Some`]: core::option::Option<T>::Some
/// [`None`]: Option<T>::None
/// [`Some`]: Option<T>::Some
/// [`Reflect`]: bevy_reflect_derive::Reflect
pub trait Enum: Reflect {
/// Returns a reference to the value of the field (in the current variant) with the given name.

View file

@ -1166,8 +1166,8 @@ impl<T: FromReflect + Clone + TypePath> List for Cow<'static, [T]> {
self.as_ref().len()
}
fn iter(&self) -> crate::ListIter {
crate::ListIter::new(self)
fn iter(&self) -> ListIter {
ListIter::new(self)
}
fn drain(self: Box<Self>) -> Vec<Box<dyn Reflect>> {
@ -1474,7 +1474,7 @@ impl Reflect for Cow<'static, Path> {
}
}
fn debug(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn debug(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self, f)
}
}

View file

@ -1281,11 +1281,11 @@ mod tests {
// TypeInfo
let info = i32::type_info();
assert_eq!(i32::type_path(), info.type_path());
assert_eq!(std::any::TypeId::of::<i32>(), info.type_id());
assert_eq!(TypeId::of::<i32>(), info.type_id());
// TypeInfo (unsized)
assert_eq!(
std::any::TypeId::of::<dyn Reflect>(),
TypeId::of::<dyn Reflect>(),
<dyn Reflect as Typed>::type_info().type_id()
);
@ -1306,10 +1306,7 @@ mod tests {
assert!(info.is::<MyStruct>());
assert_eq!(MyStruct::type_path(), info.type_path());
assert_eq!(i32::type_path(), info.field("foo").unwrap().type_path());
assert_eq!(
std::any::TypeId::of::<i32>(),
info.field("foo").unwrap().type_id()
);
assert_eq!(TypeId::of::<i32>(), info.field("foo").unwrap().type_id());
assert!(info.field("foo").unwrap().is::<i32>());
assert_eq!("foo", info.field("foo").unwrap().name());
assert_eq!(usize::type_path(), info.field_at(1).unwrap().type_path());
@ -1990,7 +1987,7 @@ bevy_reflect::tests::Test {
let de = UntypedReflectDeserializer::new(&registry);
let mut deserializer =
ron::de::Deserializer::from_str(data).expect("Failed to acquire deserializer");
Deserializer::from_str(data).expect("Failed to acquire deserializer");
let dynamic_struct = de
.deserialize(&mut deserializer)
@ -2047,7 +2044,7 @@ bevy_reflect::tests::Test {
let de = UntypedReflectDeserializer::new(&registry);
let mut deserializer =
ron::de::Deserializer::from_str(data).expect("Failed to acquire deserializer");
Deserializer::from_str(data).expect("Failed to acquire deserializer");
let dynamic_struct = de
.deserialize(&mut deserializer)

View file

@ -46,7 +46,6 @@ use crate::{
///
/// [list-like]: https://doc.rust-lang.org/book/ch08-01-vectors.html
/// [reflection]: crate
/// [`Vec`]: std::vec::Vec
/// [type-erasing]: https://doc.rust-lang.org/book/ch17-02-trait-objects.html
pub trait List: Reflect {
/// Returns a reference to the element at `index`, or `None` if out of bounds.
@ -414,7 +413,7 @@ impl<'a> ExactSizeIterator for ListIter<'a> {}
#[inline]
pub fn list_hash<L: List>(list: &L) -> Option<u64> {
let mut hasher = reflect_hasher();
std::any::Any::type_id(list).hash(&mut hasher);
Any::type_id(list).hash(&mut hasher);
list.len().hash(&mut hasher);
for value in list.iter() {
hasher.write_u64(value.reflect_hash()?);
@ -493,7 +492,7 @@ pub fn list_partial_eq<L: List>(a: &L, b: &dyn Reflect) -> Option<bool> {
/// // ]
/// ```
#[inline]
pub fn list_debug(dyn_list: &dyn List, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
pub fn list_debug(dyn_list: &dyn List, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut debug = f.debug_list();
for item in dyn_list.iter() {
debug.entry(&item as &dyn Debug);

View file

@ -41,7 +41,6 @@ use crate::{
///
/// [map-like]: https://doc.rust-lang.org/book/ch08-03-hash-maps.html
/// [reflection]: crate
/// [`HashMap`]: bevy_utils::HashMap
pub trait Map: Reflect {
/// Returns a reference to the value associated with the given key.
///
@ -486,7 +485,7 @@ pub fn map_partial_eq<M: Map>(a: &M, b: &dyn Reflect) -> Option<bool> {
/// // }
/// ```
#[inline]
pub fn map_debug(dyn_map: &dyn Map, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
pub fn map_debug(dyn_map: &dyn Map, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut debug = f.debug_map();
for (key, value) in dyn_map.iter() {
debug.entry(&key as &dyn Debug, &value as &dyn Debug);

View file

@ -7,8 +7,7 @@ use crate::{
};
use erased_serde::Deserializer;
use serde::de::{
self, DeserializeSeed, EnumAccess, Error, IgnoredAny, MapAccess, SeqAccess, VariantAccess,
Visitor,
DeserializeSeed, EnumAccess, Error, IgnoredAny, MapAccess, SeqAccess, VariantAccess, Visitor,
};
use serde::Deserialize;
use std::any::TypeId;
@ -74,7 +73,7 @@ impl Container for StructInfo {
registry: &'a TypeRegistry,
) -> Result<&'a TypeRegistration, E> {
let field = self.field_at(index).ok_or_else(|| {
de::Error::custom(format_args!(
Error::custom(format_args!(
"no field at index {} on struct {}",
index,
self.type_path(),
@ -113,7 +112,7 @@ impl Container for StructVariantInfo {
registry: &'a TypeRegistry,
) -> Result<&'a TypeRegistration, E> {
let field = self.field_at(index).ok_or_else(|| {
de::Error::custom(format_args!(
Error::custom(format_args!(
"no field at index {} on variant {}",
index,
self.name(),
@ -144,7 +143,7 @@ impl Container for TupleInfo {
registry: &'a TypeRegistry,
) -> Result<&'a TypeRegistration, E> {
let field = self.field_at(index).ok_or_else(|| {
de::Error::custom(format_args!(
Error::custom(format_args!(
"no field at index {} on tuple {}",
index,
self.type_path(),
@ -175,7 +174,7 @@ impl Container for TupleStructInfo {
registry: &'a TypeRegistry,
) -> Result<&'a TypeRegistration, E> {
let field = self.field_at(index).ok_or_else(|| {
de::Error::custom(format_args!(
Error::custom(format_args!(
"no field at index {} on tuple struct {}",
index,
self.type_path(),
@ -206,7 +205,7 @@ impl Container for TupleVariantInfo {
registry: &'a TypeRegistry,
) -> Result<&'a TypeRegistration, E> {
let field = self.field_at(index).ok_or_else(|| {
de::Error::custom(format_args!(
Error::custom(format_args!(
"no field at index {} on tuple variant {}",
index,
self.name(),
@ -253,7 +252,7 @@ impl<'de> Deserialize<'de> for Ident {
impl<'de> Visitor<'de> for IdentVisitor {
type Value = Ident;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("identifier")
}
@ -281,7 +280,7 @@ struct U32Visitor;
impl<'de> Visitor<'de> for U32Visitor {
type Value = u32;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("u32")
}
@ -313,8 +312,6 @@ impl<'de> Visitor<'de> for U32Visitor {
/// [`TypedReflectDeserializer`] may be used instead to avoid requiring these entries.
///
/// [`Box<dyn Reflect>`]: crate::Reflect
/// [`DynamicStruct`]: crate::DynamicStruct
/// [`DynamicList`]: crate::DynamicList
/// [`FromReflect`]: crate::FromReflect
/// [type path]: crate::TypePath::type_path
pub struct UntypedReflectDeserializer<'a> {
@ -346,7 +343,7 @@ impl<'a, 'de> DeserializeSeed<'de> for UntypedReflectDeserializer<'a> {
/// This deserializer expects a string containing the _full_ [type path] of the
/// type to find the `TypeRegistration` of.
///
/// [`&TypeRegistration`]: crate::TypeRegistration
/// [`&TypeRegistration`]: TypeRegistration
/// [type path]: crate::TypePath::type_path
pub struct TypeRegistrationDeserializer<'a> {
registry: &'a TypeRegistry,
@ -370,7 +367,7 @@ impl<'a, 'de> DeserializeSeed<'de> for TypeRegistrationDeserializer<'a> {
impl<'de, 'a> Visitor<'de> for TypeRegistrationVisitor<'a> {
type Value = &'a TypeRegistration;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("string containing `type` entry for the reflected value")
}
@ -395,7 +392,7 @@ struct UntypedReflectDeserializerVisitor<'a> {
impl<'a, 'de> Visitor<'de> for UntypedReflectDeserializerVisitor<'a> {
type Value = Box<dyn Reflect>;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("map containing `type` and `value` entries for the reflected value")
}
@ -433,10 +430,7 @@ impl<'a, 'de> Visitor<'de> for UntypedReflectDeserializerVisitor<'a> {
///
/// If the type is not known ahead of time, use [`UntypedReflectDeserializer`] instead.
///
/// [`TypeInfo`]: crate::TypeInfo
/// [`Box<dyn Reflect>`]: crate::Reflect
/// [`DynamicStruct`]: crate::DynamicStruct
/// [`DynamicList`]: crate::DynamicList
/// [`FromReflect`]: crate::FromReflect
pub struct TypedReflectDeserializer<'a> {
registration: &'a TypeRegistration,
@ -558,7 +552,7 @@ impl<'a, 'de> DeserializeSeed<'de> for TypedReflectDeserializer<'a> {
}
TypeInfo::Value(_) => {
// This case should already be handled
Err(de::Error::custom(format_args!(
Err(Error::custom(format_args!(
"the TypeRegistration for {type_path} doesn't have ReflectDeserialize",
)))
}
@ -575,7 +569,7 @@ struct StructVisitor<'a> {
impl<'a, 'de> Visitor<'de> for StructVisitor<'a> {
type Value = DynamicStruct;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected struct value")
}
@ -603,7 +597,7 @@ struct TupleStructVisitor<'a> {
impl<'a, 'de> Visitor<'de> for TupleStructVisitor<'a> {
type Value = DynamicTupleStruct;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected tuple struct value")
}
@ -630,7 +624,7 @@ struct TupleVisitor<'a> {
impl<'a, 'de> Visitor<'de> for TupleVisitor<'a> {
type Value = DynamicTuple;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected tuple value")
}
@ -650,7 +644,7 @@ struct ArrayVisitor<'a> {
impl<'a, 'de> Visitor<'de> for ArrayVisitor<'a> {
type Value = DynamicArray;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected array value")
}
@ -690,7 +684,7 @@ struct ListVisitor<'a> {
impl<'a, 'de> Visitor<'de> for ListVisitor<'a> {
type Value = DynamicList;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected list value")
}
@ -722,7 +716,7 @@ struct MapVisitor<'a> {
impl<'a, 'de> Visitor<'de> for MapVisitor<'a> {
type Value = DynamicMap;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected map value")
}
@ -765,7 +759,7 @@ struct EnumVisitor<'a> {
impl<'a, 'de> Visitor<'de> for EnumVisitor<'a> {
type Value = DynamicEnum;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected enum value")
}
@ -878,7 +872,7 @@ struct StructVariantVisitor<'a> {
impl<'a, 'de> Visitor<'de> for StructVariantVisitor<'a> {
type Value = DynamicStruct;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected struct variant value")
}
@ -906,7 +900,7 @@ struct TupleVariantVisitor<'a> {
impl<'a, 'de> Visitor<'de> for TupleVariantVisitor<'a> {
type Value = DynamicTuple;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("reflected tuple variant value")
}

View file

@ -28,14 +28,14 @@ impl<'a> Serializable<'a> {
}
}
fn get_serializable<'a, E: serde::ser::Error>(
fn get_serializable<'a, E: Error>(
reflect_value: &'a dyn Reflect,
type_registry: &TypeRegistry,
) -> Result<Serializable<'a>, E> {
let reflect_serialize = type_registry
.get_type_data::<ReflectSerialize>(reflect_value.type_id())
.ok_or_else(|| {
serde::ser::Error::custom(format_args!(
Error::custom(format_args!(
"Type '{}' did not register ReflectSerialize",
reflect_value.reflect_type_path()
))

View file

@ -542,7 +542,7 @@ pub fn struct_partial_eq<S: Struct>(a: &S, b: &dyn Reflect) -> Option<bool> {
/// // }
/// ```
#[inline]
pub fn struct_debug(dyn_struct: &dyn Struct, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
pub fn struct_debug(dyn_struct: &dyn Struct, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut debug = f.debug_struct(dyn_struct.reflect_type_path());
for field_index in 0..dyn_struct.field_len() {
let field = dyn_struct.field_at(field_index).unwrap();

View file

@ -446,7 +446,7 @@ pub fn tuple_partial_eq<T: Tuple>(a: &T, b: &dyn Reflect) -> Option<bool> {
/// // )
/// ```
#[inline]
pub fn tuple_debug(dyn_tuple: &dyn Tuple, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
pub fn tuple_debug(dyn_tuple: &dyn Tuple, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut debug = f.debug_tuple("");
for field in dyn_tuple.iter_fields() {
debug.field(&field as &dyn Debug);

View file

@ -451,7 +451,7 @@ pub fn tuple_struct_partial_eq<S: TupleStruct>(a: &S, b: &dyn Reflect) -> Option
#[inline]
pub fn tuple_struct_debug(
dyn_tuple_struct: &dyn TupleStruct,
f: &mut std::fmt::Formatter<'_>,
f: &mut Formatter<'_>,
) -> std::fmt::Result {
let mut debug = f.debug_tuple(dyn_tuple_struct.reflect_type_path());
for field in dyn_tuple_struct.iter_fields() {

View file

@ -95,9 +95,8 @@ pub trait Typed: Reflect + TypePath {
/// it can be more performant. This is because those other methods may require attaining a lock on
/// the static [`TypeInfo`], while the registry simply checks a map.
///
/// [`Reflect::get_represented_type_info`]: crate::Reflect::get_represented_type_info
/// [`Reflect::get_represented_type_info`]: Reflect::get_represented_type_info
/// [`TypeRegistry::get_type_info`]: crate::TypeRegistry::get_type_info
/// [`TypeId`]: std::any::TypeId
/// [type path]: TypePath::type_path
#[derive(Debug, Clone)]
pub enum TypeInfo {

View file

@ -167,7 +167,6 @@ impl TypeRegistry {
///
/// If the specified type has not been registered, returns `None`.
///
/// [`TypeId`]: std::any::TypeId
pub fn get(&self, type_id: TypeId) -> Option<&TypeRegistration> {
self.registrations.get(&type_id)
}
@ -177,7 +176,6 @@ impl TypeRegistry {
///
/// If the specified type has not been registered, returns `None`.
///
/// [`TypeId`]: std::any::TypeId
pub fn get_mut(&mut self, type_id: TypeId) -> Option<&mut TypeRegistration> {
self.registrations.get_mut(&type_id)
}
@ -335,7 +333,6 @@ impl Debug for TypeRegistration {
impl TypeRegistration {
/// Returns the [`TypeId`] of the type.
///
/// [`TypeId`]: std::any::TypeId
#[inline]
pub fn type_id(&self) -> TypeId {
self.type_info.type_id()
@ -582,7 +579,7 @@ impl ReflectFromPtr {
impl<T: Reflect> FromType<T> for ReflectFromPtr {
fn from_type() -> Self {
ReflectFromPtr {
type_id: std::any::TypeId::of::<T>(),
type_id: TypeId::of::<T>(),
from_ptr: |ptr| {
// SAFETY: `from_ptr_mut` is either called in `ReflectFromPtr::as_reflect`
// or returned by `ReflectFromPtr::from_ptr`, both lay out the invariants

View file

@ -368,7 +368,7 @@ pub enum CameraOutputMode {
blend_state: Option<BlendState>,
/// The color attachment load operation that will be used by the pipeline that writes the intermediate render textures to the final render
/// target texture.
color_attachment_load_op: wgpu::LoadOp<wgpu::Color>,
color_attachment_load_op: LoadOp<wgpu::Color>,
},
/// Skips writing the camera output to the configured render target. The output will remain in the
/// Render Target's "intermediate" textures, which a camera with a higher order should write to the render target
@ -562,7 +562,6 @@ impl NormalizedRenderTarget {
///
/// [`OrthographicProjection`]: crate::camera::OrthographicProjection
/// [`PerspectiveProjection`]: crate::camera::PerspectiveProjection
/// [`Projection`]: crate::camera::Projection
#[allow(clippy::too_many_arguments)]
pub fn camera_system<T: CameraProjection + Component>(
mut window_resized_events: EventReader<WindowResized>,

View file

@ -87,7 +87,7 @@ pub enum RenderSet {
ManageViews,
/// The copy of [`apply_deferred`] that runs immediately after [`ManageViews`](RenderSet::ManageViews).
ManageViewsFlush,
/// Queue drawable entities as phase items in [`RenderPhase`](crate::render_phase::RenderPhase)s
/// Queue drawable entities as phase items in [`RenderPhase`](render_phase::RenderPhase)s
/// ready for sorting
Queue,
/// A sub-set within [`Queue`](RenderSet::Queue) where mesh entity queue systems are executed. Ensures `prepare_assets::<Mesh>` is completed.
@ -96,7 +96,7 @@ pub enum RenderSet {
/// Sort the [`RenderPhases`](render_phase::RenderPhase) here.
PhaseSort,
/// Prepare render resources from extracted data for the GPU based on their sorted order.
/// Create [`BindGroups`](crate::render_resource::BindGroup) that depend on those data.
/// Create [`BindGroups`](render_resource::BindGroup) that depend on those data.
Prepare,
/// A sub-set within [`Prepare`](RenderSet::Prepare) for initializing buffers, textures and uniforms for use in bind groups.
PrepareResources,
@ -158,11 +158,7 @@ impl Render {
);
schedule.configure_sets((ExtractCommands, PrepareAssets, Prepare).chain());
schedule.configure_sets(
QueueMeshes
.in_set(RenderSet::Queue)
.after(prepare_assets::<Mesh>),
);
schedule.configure_sets(QueueMeshes.in_set(Queue).after(prepare_assets::<Mesh>));
schedule.configure_sets(
(PrepareResources, PrepareResourcesFlush, PrepareBindGroups)
.chain()
@ -179,7 +175,7 @@ impl Render {
/// running the next frame while rendering the current frame.
///
/// This schedule is run on the main world, but its buffers are not applied
/// via [`Schedule::apply_deferred`](bevy_ecs::schedule::Schedule) until it is returned to the render world.
/// via [`Schedule::apply_deferred`](Schedule) until it is returned to the render world.
#[derive(ScheduleLabel, PartialEq, Eq, Debug, Clone, Hash)]
pub struct ExtractSchedule;

View file

@ -31,7 +31,7 @@ pub const VERTEX_ATTRIBUTE_BUFFER_ID: u64 = 10;
/// with "attribute" values for each vertex.
///
/// Meshes can be automatically generated by a bevy `AssetLoader` (generally by loading a `Gltf` file),
/// or by converting a primitive [`shape`](crate::mesh::shape) using [`into`](std::convert::Into).
/// or by converting a primitive [`shape`](crate::mesh::shape) using [`into`](Into).
/// It is also possible to create one manually.
/// They can be edited after creation.
///
@ -756,7 +756,7 @@ pub trait VertexFormatSize {
fn get_size(self) -> u64;
}
impl VertexFormatSize for wgpu::VertexFormat {
impl VertexFormatSize for VertexFormat {
#[allow(clippy::match_same_arms)]
fn get_size(self) -> u64 {
match self {
@ -1151,7 +1151,7 @@ impl bevy_mikktspace::Geometry for MikktspaceGeometryHelper<'_> {
}
}
#[derive(thiserror::Error, Debug)]
#[derive(Error, Debug)]
/// Failed to generate tangents for the mesh.
pub enum GenerateTangentsError {
#[error("cannot generate tangents for {0:?}")]

View file

@ -37,7 +37,7 @@ pub struct RenderToMainAppReceiver(pub Receiver<SubApp>);
/// |--------------------|--------------------|--------------------|--------------------|
/// ```
///
/// The plugin is dependent on the [`crate::RenderApp`] added by [`crate::RenderPlugin`] and so must
/// The plugin is dependent on the [`RenderApp`] added by [`crate::RenderPlugin`] and so must
/// be added after that plugin. If it is not added after, the plugin will do nothing.
///
/// A single frame of execution looks something like below

View file

@ -137,7 +137,7 @@ where
const METADATA: Metadata<Self::ExtraMetadata> = T::METADATA;
fn size(&self) -> ::core::num::NonZeroU64 {
fn size(&self) -> NonZeroU64 {
Self::METADATA.stride().mul(self.1.max(1) as u64).0
}
}

View file

@ -20,7 +20,7 @@ render_resource_wrapper!(ErasedBindGroup, wgpu::BindGroup);
/// This makes them accessible in the pipeline (shaders) as uniforms.
///
/// May be converted from and dereferences to a wgpu [`BindGroup`](wgpu::BindGroup).
/// Can be created via [`RenderDevice::create_bind_group`](crate::renderer::RenderDevice::create_bind_group).
/// Can be created via [`RenderDevice::create_bind_group`](RenderDevice::create_bind_group).
#[derive(Clone, Debug)]
pub struct BindGroup {
id: BindGroupId,

View file

@ -144,12 +144,8 @@ impl BindGroupLayoutEntryBuilder {
self
}
pub fn build(
&self,
binding: u32,
default_visibility: ShaderStages,
) -> wgpu::BindGroupLayoutEntry {
wgpu::BindGroupLayoutEntry {
pub fn build(&self, binding: u32, default_visibility: ShaderStages) -> BindGroupLayoutEntry {
BindGroupLayoutEntry {
binding,
ty: self.ty,
visibility: self.visibility.unwrap_or(default_visibility),
@ -159,7 +155,7 @@ impl BindGroupLayoutEntryBuilder {
}
pub struct BindGroupLayoutEntries<const N: usize> {
entries: [wgpu::BindGroupLayoutEntry; N],
entries: [BindGroupLayoutEntry; N],
}
impl<const N: usize> BindGroupLayoutEntries<N> {
@ -203,8 +199,8 @@ impl BindGroupLayoutEntries<1> {
}
impl<const N: usize> std::ops::Deref for BindGroupLayoutEntries<N> {
type Target = [wgpu::BindGroupLayoutEntry];
fn deref(&self) -> &[wgpu::BindGroupLayoutEntry] {
type Target = [BindGroupLayoutEntry];
fn deref(&self) -> &[BindGroupLayoutEntry] {
&self.entries
}
}
@ -223,7 +219,7 @@ impl IntoBindGroupLayoutEntryBuilder for BindingType {
}
}
impl IntoBindGroupLayoutEntryBuilder for wgpu::BindGroupLayoutEntry {
impl IntoBindGroupLayoutEntryBuilder for BindGroupLayoutEntry {
fn into_bind_group_layout_entry_builder(self) -> BindGroupLayoutEntryBuilder {
if self.binding != u32::MAX {
bevy_log::warn!("The BindGroupLayoutEntries api ignores the binding index when converting a raw wgpu::BindGroupLayoutEntry. You can ignore this warning by setting it to u32::MAX.");

View file

@ -15,9 +15,9 @@ use wgpu::BufferUsages;
/// Index, vertex, and instance-rate vertex buffers have no alignment nor padding requirements and
/// so this helper type is a good choice for them.
///
/// The contained data is stored in system RAM. Calling [`reserve`](crate::render_resource::BufferVec::reserve)
/// The contained data is stored in system RAM. Calling [`reserve`](BufferVec::reserve)
/// allocates VRAM from the [`RenderDevice`].
/// [`write_buffer`](crate::render_resource::BufferVec::write_buffer) queues copying of the data
/// [`write_buffer`](BufferVec::write_buffer) queues copying of the data
/// from system RAM to VRAM.
///
/// Other options for storing GPU-accessible data are:
@ -105,7 +105,7 @@ impl<T: Pod> BufferVec<T> {
///
/// In addition to any [`BufferUsages`] provided when
/// the `BufferVec` was created, the buffer on the [`RenderDevice`]
/// is marked as [`BufferUsages::COPY_DST`](crate::render_resource::BufferUsages).
/// is marked as [`BufferUsages::COPY_DST`](BufferUsages).
pub fn reserve(&mut self, capacity: usize, device: &RenderDevice) {
if capacity > self.capacity || self.label_changed {
self.capacity = capacity;
@ -123,7 +123,7 @@ impl<T: Pod> BufferVec<T> {
/// Queues writing of data from system RAM to VRAM using the [`RenderDevice`]
/// and the provided [`RenderQueue`].
///
/// Before queuing the write, a [`reserve`](crate::render_resource::BufferVec::reserve) operation
/// Before queuing the write, a [`reserve`](BufferVec::reserve) operation
/// is executed.
pub fn write_buffer(&mut self, device: &RenderDevice, queue: &RenderQueue) {
if self.values.is_empty() {

View file

@ -15,7 +15,7 @@ use wgpu::{util::BufferInitDescriptor, BindingResource, BufferBinding, BufferUsa
///
/// Storage buffers can store runtime-sized arrays, but only if they are the last field in a structure.
///
/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::StorageBuffer::write_buffer) queues
/// The contained data is stored in system RAM. [`write_buffer`](StorageBuffer::write_buffer) queues
/// copying of the data from system RAM to VRAM. Storage buffers must conform to [std430 alignment/padding requirements], which
/// is automatically enforced by this structure.
///
@ -141,12 +141,12 @@ impl<T: ShaderType + WriteInto> StorageBuffer<T> {
/// Dynamic storage buffers can be made available to shaders in some combination of read/write mode, and can store large amounts
/// of data. Note however that WebGL2 does not support storage buffers, so consider alternative options in this case. Dynamic
/// storage buffers support multiple separate bindings at dynamic byte offsets and so have a
/// [`push`](crate::render_resource::DynamicStorageBuffer::push) method.
/// [`push`](DynamicStorageBuffer::push) method.
///
/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::DynamicStorageBuffer::write_buffer)
/// The contained data is stored in system RAM. [`write_buffer`](DynamicStorageBuffer::write_buffer)
/// queues copying of the data from system RAM to VRAM. The data within a storage buffer binding must conform to
/// [std430 alignment/padding requirements]. `DynamicStorageBuffer` takes care of serialising the inner type to conform to
/// these requirements. Each item [`push`](crate::render_resource::DynamicStorageBuffer::push)ed into this structure
/// these requirements. Each item [`push`](DynamicStorageBuffer::push)ed into this structure
/// will additionally be aligned to meet dynamic offset alignment requirements.
///
/// Other options for storing GPU-accessible data are:

View file

@ -21,7 +21,7 @@ use super::IntoBinding;
/// parameters that are constant during shader execution, and are best used for data that is relatively small in size as they are
/// only guaranteed to support up to 16kB per binding.
///
/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::UniformBuffer::write_buffer) queues
/// The contained data is stored in system RAM. [`write_buffer`](UniformBuffer::write_buffer) queues
/// copying of the data from system RAM to VRAM. Data in uniform buffers must follow [std140 alignment/padding requirements],
/// which is automatically enforced by this structure. Per the WGPU spec, uniform buffers cannot store runtime-sized array
/// (vectors), or structures with fields that are vectors.
@ -157,7 +157,7 @@ impl<'a, T: ShaderType + WriteInto> IntoBinding<'a> for &'a UniformBuffer<T> {
/// available to shaders runtime-sized arrays of parameters that are otherwise constant during shader execution, and are best
/// suited to data that is relatively small in size as they are only guaranteed to support up to 16kB per binding.
///
/// The contained data is stored in system RAM. [`write_buffer`](crate::render_resource::DynamicUniformBuffer::write_buffer) queues
/// The contained data is stored in system RAM. [`write_buffer`](DynamicUniformBuffer::write_buffer) queues
/// copying of the data from system RAM to VRAM. Data in uniform buffers must follow [std140 alignment/padding requirements],
/// which is automatically enforced by this structure. Per the WGPU spec, uniform buffers cannot store runtime-sized array
/// (vectors), or structures with fields that are vectors.
@ -368,7 +368,7 @@ impl<'a, T: ShaderType + WriteInto> DynamicUniformBufferWriter<'a, T> {
}
/// A wrapper to work around the orphan rule so that [`wgpu::QueueWriteBufferView`] can implement
/// [`encase::internal::BufferMut`].
/// [`BufferMut`].
struct QueueWriteBufferViewWrapper<'a> {
buffer_view: wgpu::QueueWriteBufferView<'a>,
// Must be kept separately and cannot be retrieved from buffer_view, as the read-only access will

View file

@ -105,7 +105,7 @@ pub fn render_system(world: &mut World) {
pub struct RenderQueue(pub Arc<Queue>);
/// The handle to the physical device being used for rendering.
/// See [`wgpu::Adapter`] for more info.
/// See [`Adapter`] for more info.
#[derive(Resource, Clone, Debug, Deref, DerefMut)]
pub struct RenderAdapter(pub Arc<Adapter>);

View file

@ -18,8 +18,8 @@ pub enum WgpuSettingsPriority {
WebGL2,
}
/// Provides configuration for renderer initialization. Use [`RenderDevice::features`](crate::renderer::RenderDevice::features),
/// [`RenderDevice::limits`](crate::renderer::RenderDevice::limits), and the [`RenderAdapterInfo`]
/// Provides configuration for renderer initialization. Use [`RenderDevice::features`](RenderDevice::features),
/// [`RenderDevice::limits`](RenderDevice::limits), and the [`RenderAdapterInfo`]
/// resource to get runtime information about the actual adapter, backend, features, and limits.
/// NOTE: [`Backends::DX12`](Backends::DX12), [`Backends::METAL`](Backends::METAL), and
/// [`Backends::VULKAN`](Backends::VULKAN) are enabled by default for non-web and the best choice

View file

@ -24,7 +24,7 @@ impl AssetSaver for CompressedImageSaver {
writer: &'a mut bevy_asset::io::Writer,
image: SavedAsset<'a, Self::Asset>,
_settings: &'a Self::Settings,
) -> bevy_utils::BoxedFuture<'a, std::result::Result<ImageLoaderSettings, Self::Error>> {
) -> bevy_utils::BoxedFuture<'a, Result<ImageLoaderSettings, Self::Error>> {
// PERF: this should live inside the future, but CompressorParams and Compressor are not Send / can't be owned by the BoxedFuture (which _is_ Send)
let mut compressor_params = basis_universal::CompressorParams::new();
compressor_params.set_basis_format(basis_universal::BasisTextureFormat::UASTC4x4);

View file

@ -109,7 +109,7 @@ pub struct Image {
pub texture_descriptor: wgpu::TextureDescriptor<'static>,
/// The [`ImageSampler`] to use during rendering.
pub sampler: ImageSampler,
pub texture_view_descriptor: Option<wgpu::TextureViewDescriptor<'static>>,
pub texture_view_descriptor: Option<TextureViewDescriptor<'static>>,
}
/// Used in [`Image`], this determines what image sampler to use when rendering. The default setting,
@ -444,18 +444,18 @@ impl<'a> From<wgpu::SamplerDescriptor<'a>> for ImageSamplerDescriptor {
impl Default for Image {
/// default is a 1x1x1 all '1.0' texture
fn default() -> Self {
let format = wgpu::TextureFormat::bevy_default();
let format = TextureFormat::bevy_default();
let data = vec![255; format.pixel_size()];
Image {
data,
texture_descriptor: wgpu::TextureDescriptor {
size: wgpu::Extent3d {
size: Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
format,
dimension: wgpu::TextureDimension::D2,
dimension: TextureDimension::D2,
label: None,
mip_level_count: 1,
sample_count: 1,

View file

@ -137,7 +137,7 @@ pub struct FileTextureError {
path: String,
}
impl std::fmt::Display for FileTextureError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(
f,
"Error reading image file {}: {}, this is an error in `bevy_render`.",

View file

@ -28,7 +28,7 @@ pub struct CachedTexture {
/// are only required for one frame.
#[derive(Resource, Default)]
pub struct TextureCache {
textures: HashMap<wgpu::TextureDescriptor<'static>, Vec<CachedTextureMeta>>,
textures: HashMap<TextureDescriptor<'static>, Vec<CachedTextureMeta>>,
}
impl TextureCache {

View file

@ -46,7 +46,7 @@ pub enum Visibility {
}
// Allows `&Visibility == Visibility`
impl std::cmp::PartialEq<Visibility> for &Visibility {
impl PartialEq<Visibility> for &Visibility {
#[inline]
fn eq(&self, other: &Visibility) -> bool {
**self == *other
@ -54,7 +54,7 @@ impl std::cmp::PartialEq<Visibility> for &Visibility {
}
// Allows `Visibility == &Visibility`
impl std::cmp::PartialEq<&Visibility> for Visibility {
impl PartialEq<&Visibility> for Visibility {
#[inline]
fn eq(&self, other: &&Visibility) -> bool {
*self == **other

View file

@ -32,7 +32,7 @@ impl std::fmt::Debug for RenderLayers {
}
}
impl std::iter::FromIterator<Layer> for RenderLayers {
impl FromIterator<Layer> for RenderLayers {
fn from_iter<T: IntoIterator<Item = Layer>>(i: T) -> Self {
i.into_iter().fold(Self::none(), |mask, g| mask.with(g))
}
@ -174,7 +174,7 @@ mod rendering_mask_tests {
);
assert_eq!(
RenderLayers::from_layers(&[0, 1, 2]),
<RenderLayers as std::iter::FromIterator<Layer>>::from_iter(vec![0, 1, 2]),
<RenderLayers as FromIterator<Layer>>::from_iter(vec![0, 1, 2]),
"from_layers and from_iter are equivalent"
);
}

View file

@ -284,7 +284,7 @@ pub fn prepare_windows(
format: surface_data.format,
width: window.physical_width,
height: window.physical_height,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
usage: TextureUsages::RENDER_ATTACHMENT,
present_mode: match window.present_mode {
PresentMode::Fifo => wgpu::PresentMode::Fifo,
PresentMode::FifoRelaxed => wgpu::PresentMode::FifoRelaxed,

View file

@ -153,8 +153,8 @@ impl Plugin for ScreenshotPlugin {
#[cfg(feature = "bevy_ci_testing")]
fn ci_testing_screenshot_at(
mut current_frame: bevy_ecs::prelude::Local<u32>,
ci_testing_config: bevy_ecs::prelude::Res<bevy_app::ci_testing::CiTestingConfig>,
mut current_frame: Local<u32>,
ci_testing_config: Res<bevy_app::ci_testing::CiTestingConfig>,
mut screenshot_manager: ResMut<ScreenshotManager>,
main_window: Query<Entity, With<bevy_window::PrimaryWindow>>,
) {
@ -268,7 +268,7 @@ pub(crate) fn submit_screenshot_commands(world: &World, encoder: &mut CommandEnc
memory.texture.as_image_copy(),
wgpu::ImageCopyBuffer {
buffer: &memory.buffer,
layout: crate::view::screenshot::layout_data(width, height, texture_format),
layout: layout_data(width, height, texture_format),
},
Extent3d {
width,

View file

@ -88,7 +88,7 @@ impl<'a> SceneSerializer<'a> {
impl<'a> Serialize for SceneSerializer<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: Serializer,
{
let mut state = serializer.serialize_struct(SCENE_STRUCT, 2)?;
state.serialize_field(
@ -147,7 +147,7 @@ pub struct EntitySerializer<'a> {
impl<'a> Serialize for EntitySerializer<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: Serializer,
{
let mut state = serializer.serialize_struct(ENTITY_STRUCT, 1)?;
state.serialize_field(
@ -176,7 +176,7 @@ pub struct SceneMapSerializer<'a> {
impl<'a> Serialize for SceneMapSerializer<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
S: Serializer,
{
let mut state = serializer.serialize_map(Some(self.entries.len()))?;
for reflect in self.entries {
@ -213,7 +213,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneDeserializer<'a> {
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: serde::Deserializer<'de>,
D: Deserializer<'de>,
{
deserializer.deserialize_struct(
SCENE_STRUCT,
@ -236,7 +236,7 @@ impl<'a, 'de> Visitor<'de> for SceneVisitor<'a> {
formatter.write_str("scene struct")
}
fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
where
A: MapAccess<'de>,
{
@ -321,7 +321,7 @@ struct SceneEntitiesVisitor<'a> {
impl<'a, 'de> Visitor<'de> for SceneEntitiesVisitor<'a> {
type Value = Vec<DynamicEntity>;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
formatter.write_str("map of entities")
}
@ -355,7 +355,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneEntityDeserializer<'a> {
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: serde::Deserializer<'de>,
D: Deserializer<'de>,
{
deserializer.deserialize_struct(
ENTITY_STRUCT,
@ -376,11 +376,11 @@ struct SceneEntityVisitor<'a> {
impl<'a, 'de> Visitor<'de> for SceneEntityVisitor<'a> {
type Value = DynamicEntity;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
formatter.write_str("entities")
}
fn visit_seq<A>(self, mut seq: A) -> std::result::Result<Self::Value, A::Error>
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
where
A: SeqAccess<'de>,
{
@ -436,7 +436,7 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneMapDeserializer<'a> {
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: serde::Deserializer<'de>,
D: Deserializer<'de>,
{
deserializer.deserialize_map(SceneMapVisitor {
registry: self.registry,
@ -451,11 +451,11 @@ struct SceneMapVisitor<'a> {
impl<'a, 'de> Visitor<'de> for SceneMapVisitor<'a> {
type Value = Vec<Box<dyn Reflect>>;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
formatter.write_str("map of reflect types")
}
fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
where
A: MapAccess<'de>,
{

View file

@ -192,7 +192,7 @@ where
// TODO: Investigate optimizations for less copying
fn collect<C>(mut self, pool: &TaskPool) -> C
where
C: std::iter::FromIterator<BatchIter::Item>,
C: FromIterator<BatchIter::Item>,
BatchIter::Item: Send + 'static,
{
pool.scope(|s| {

View file

@ -823,17 +823,17 @@ mod tests {
let count_clone = count.clone();
let inner_pool = pool.clone();
let inner_thread_check_failed = thread_check_failed.clone();
std::thread::spawn(move || {
thread::spawn(move || {
inner_pool.scope(|scope| {
let inner_count_clone = count_clone.clone();
scope.spawn(async move {
inner_count_clone.fetch_add(1, Ordering::Release);
});
let spawner = std::thread::current().id();
let spawner = thread::current().id();
let inner_count_clone = count_clone.clone();
scope.spawn_on_scope(async move {
inner_count_clone.fetch_add(1, Ordering::Release);
if std::thread::current().id() != spawner {
if thread::current().id() != spawner {
// NOTE: This check is using an atomic rather than simply panicking the
// thread to avoid deadlocking the barrier on failure
inner_thread_check_failed.store(true, Ordering::Release);
@ -898,9 +898,9 @@ mod tests {
let count_clone = count.clone();
let inner_pool = pool.clone();
let inner_thread_check_failed = thread_check_failed.clone();
std::thread::spawn(move || {
thread::spawn(move || {
inner_pool.scope(|scope| {
let spawner = std::thread::current().id();
let spawner = thread::current().id();
let inner_count_clone = count_clone.clone();
scope.spawn(async move {
inner_count_clone.fetch_add(1, Ordering::Release);
@ -908,7 +908,7 @@ mod tests {
// spawning on the scope from another thread runs the futures on the scope's thread
scope.spawn_on_scope(async move {
inner_count_clone.fetch_add(1, Ordering::Release);
if std::thread::current().id() != spawner {
if thread::current().id() != spawner {
// NOTE: This check is using an atomic rather than simply panicking the
// thread to avoid deadlocking the barrier on failure
inner_thread_check_failed.store(true, Ordering::Release);

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