diff --git a/Cargo.toml b/Cargo.toml index 6b7994eae3aa2..6de2dccefc702 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -338,6 +338,7 @@ bytemuck = "1.7" futures-lite = "2.0.1" crossbeam-channel = "0.5.0" argh = "0.1.12" +thiserror = "1.0" [[example]] name = "hello_world" diff --git a/crates/bevy_animation/Cargo.toml b/crates/bevy_animation/Cargo.toml index d5892658270c1..e47fefb987848 100644 --- a/crates/bevy_animation/Cargo.toml +++ b/crates/bevy_animation/Cargo.toml @@ -26,7 +26,7 @@ bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.14.0-dev" } # other sha1_smol = { version = "1.0" } -uuid = { version = "1.7", features = ["v5"] } +uuid = { version = "1.7", features = ["v4"] } [lints] workspace = true diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index c420e8d98abc5..08f10a167dfd2 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -20,8 +20,9 @@ use bevy_render::mesh::morph::MorphWeights; use bevy_time::Time; use bevy_transform::{prelude::Transform, TransformSystem}; use bevy_utils::hashbrown::HashMap; -use bevy_utils::{tracing::error, NoOpHash, Uuid}; +use bevy_utils::{tracing::error, NoOpHash}; use sha1_smol::Sha1; +use uuid::Uuid; #[allow(missing_docs)] pub mod prelude { diff --git a/crates/bevy_app/Cargo.toml b/crates/bevy_app/Cargo.toml index e42d986f1a669..e4f7649325776 100644 --- a/crates/bevy_app/Cargo.toml +++ b/crates/bevy_app/Cargo.toml @@ -26,7 +26,7 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" } serde = { version = "1.0", features = ["derive"], optional = true } ron = { version = "0.8.0", optional = true } downcast-rs = "1.2.0" - +thiserror = "1.0" [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = { version = "0.2" } diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index f339b5d8002f5..10f567f2f211c 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -7,11 +7,12 @@ use bevy_ecs::{ InternedScheduleLabel, ScheduleBuildSettings, ScheduleLabel, }, }; -use bevy_utils::{intern::Interned, thiserror::Error, tracing::debug, HashMap, HashSet}; +use bevy_utils::{intern::Interned, tracing::debug, HashMap, HashSet}; use std::{ fmt::Debug, panic::{catch_unwind, resume_unwind, AssertUnwindSafe}, }; +use thiserror::Error; #[cfg(feature = "trace")] use bevy_utils::tracing::info_span; diff --git a/crates/bevy_app/src/plugin.rs b/crates/bevy_app/src/plugin.rs index 2609c9e5042fa..3dfb28b428ab7 100644 --- a/crates/bevy_app/src/plugin.rs +++ b/crates/bevy_app/src/plugin.rs @@ -115,8 +115,7 @@ pub trait Plugins: sealed::Plugins {} impl Plugins for T where T: sealed::Plugins {} mod sealed { - - use bevy_ecs::all_tuples; + use bevy_utils::all_tuples; use crate::{App, AppError, Plugin, PluginGroup}; diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index 4dfdb2bb02cc9..ddec0a6b6a59b 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -21,7 +21,9 @@ watch = [] bevy_app = { path = "../bevy_app", version = "0.14.0-dev" } bevy_asset_macros = { path = "macros", version = "0.14.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev" } -bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev" } +bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [ + "uuid", +] } bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" } bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } @@ -37,6 +39,7 @@ parking_lot = { version = "0.12", features = ["arc_lock", "send_guard"] } ron = "0.8" serde = { version = "1", features = ["derive"] } thiserror = "1.0" +uuid = { version = "1.0", features = ["v4"] } [target.'cfg(target_os = "android")'.dependencies] bevy_winit = { path = "../bevy_winit", version = "0.14.0-dev" } diff --git a/crates/bevy_asset/src/assets.rs b/crates/bevy_asset/src/assets.rs index c0f76d90c117d..9cf1b4e5386b7 100644 --- a/crates/bevy_asset/src/assets.rs +++ b/crates/bevy_asset/src/assets.rs @@ -7,7 +7,7 @@ use bevy_ecs::{ system::{Res, ResMut, Resource}, }; use bevy_reflect::{Reflect, TypePath}; -use bevy_utils::{HashMap, Uuid}; +use bevy_utils::HashMap; use crossbeam_channel::{Receiver, Sender}; use serde::{Deserialize, Serialize}; use std::{ @@ -17,6 +17,7 @@ use std::{ sync::{atomic::AtomicU32, Arc}, }; use thiserror::Error; +use uuid::Uuid; /// A generational runtime-only identifier for a specific [`Asset`] stored in [`Assets`]. This is optimized for efficient runtime /// usage and is not suitable for identifying assets across app runs. diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index 1107cb424ad82..d14c325973c77 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -4,7 +4,7 @@ use crate::{ }; use bevy_ecs::prelude::*; use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath}; -use bevy_utils::{get_short_name, Uuid}; +use bevy_utils::get_short_name; use crossbeam_channel::{Receiver, Sender}; use std::{ any::TypeId, @@ -12,6 +12,7 @@ use std::{ sync::Arc, }; use thiserror::Error; +use uuid::Uuid; /// Provides [`Handle`] and [`UntypedHandle`] _for a specific asset type_. /// This should _only_ be used for one specific asset type. diff --git a/crates/bevy_asset/src/id.rs b/crates/bevy_asset/src/id.rs index 1efc61bacc1af..fc98902786315 100644 --- a/crates/bevy_asset/src/id.rs +++ b/crates/bevy_asset/src/id.rs @@ -1,6 +1,6 @@ use crate::{Asset, AssetIndex}; use bevy_reflect::Reflect; -use bevy_utils::Uuid; +use uuid::Uuid; use std::{ any::TypeId, diff --git a/crates/bevy_core/Cargo.toml b/crates/bevy_core/Cargo.toml index cd769fcb0f36f..0c0c804bf7a26 100644 --- a/crates/bevy_core/Cargo.toml +++ b/crates/bevy_core/Cargo.toml @@ -24,8 +24,8 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" } bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } # other -bytemuck = "1.5" serde = { version = "1.0", optional = true } +uuid = "1.0" [features] serialize = ["dep:serde"] diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 3dc709a15e05d..c88ec31be09bf 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -6,7 +6,6 @@ mod serde; mod task_pool_options; use bevy_ecs::system::Resource; -pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable}; pub use name::*; pub use task_pool_options::*; diff --git a/crates/bevy_core_pipeline/Cargo.toml b/crates/bevy_core_pipeline/Cargo.toml index 824e78ee89923..1b28c00f649c5 100644 --- a/crates/bevy_core_pipeline/Cargo.toml +++ b/crates/bevy_core_pipeline/Cargo.toml @@ -36,6 +36,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } serde = { version = "1", features = ["derive"] } bitflags = "2.3" radsort = "0.1" +nonmax = "0.5" [lints] workspace = true diff --git a/crates/bevy_core_pipeline/src/core_2d/mod.rs b/crates/bevy_core_pipeline/src/core_2d/mod.rs index e2684e1553f2c..5dc0a5558662b 100644 --- a/crates/bevy_core_pipeline/src/core_2d/mod.rs +++ b/crates/bevy_core_pipeline/src/core_2d/mod.rs @@ -42,7 +42,8 @@ use bevy_render::{ render_resource::CachedRenderPipelineId, Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; -use bevy_utils::{nonmax::NonMaxU32, FloatOrd}; +use bevy_utils::FloatOrd; +use nonmax::NonMaxU32; use crate::{tonemapping::TonemappingNode, upscaling::UpscalingNode}; diff --git a/crates/bevy_core_pipeline/src/core_3d/mod.rs b/crates/bevy_core_pipeline/src/core_3d/mod.rs index c796d32825b8e..1e6dafa4ccb7e 100644 --- a/crates/bevy_core_pipeline/src/core_3d/mod.rs +++ b/crates/bevy_core_pipeline/src/core_3d/mod.rs @@ -67,7 +67,8 @@ use bevy_render::{ view::{ExtractedView, ViewDepthTexture, ViewTarget}, Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; -use bevy_utils::{nonmax::NonMaxU32, tracing::warn, FloatOrd, HashMap}; +use bevy_utils::{tracing::warn, FloatOrd, HashMap}; +use nonmax::NonMaxU32; use crate::{ core_3d::main_transmissive_pass_3d_node::MainTransmissivePass3dNode, diff --git a/crates/bevy_core_pipeline/src/deferred/mod.rs b/crates/bevy_core_pipeline/src/deferred/mod.rs index fd8ca0966d8ea..a6b659fdbe391 100644 --- a/crates/bevy_core_pipeline/src/deferred/mod.rs +++ b/crates/bevy_core_pipeline/src/deferred/mod.rs @@ -10,7 +10,7 @@ use bevy_render::{ render_phase::{CachedRenderPipelinePhaseItem, DrawFunctionId, PhaseItem}, render_resource::{CachedRenderPipelineId, TextureFormat}, }; -use bevy_utils::nonmax::NonMaxU32; +use nonmax::NonMaxU32; pub const DEFERRED_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgba32Uint; pub const DEFERRED_LIGHTING_PASS_ID_FORMAT: TextureFormat = TextureFormat::R8Uint; diff --git a/crates/bevy_core_pipeline/src/prepass/mod.rs b/crates/bevy_core_pipeline/src/prepass/mod.rs index c250985ffc2f8..348419336ff59 100644 --- a/crates/bevy_core_pipeline/src/prepass/mod.rs +++ b/crates/bevy_core_pipeline/src/prepass/mod.rs @@ -38,7 +38,7 @@ use bevy_render::{ render_resource::{CachedRenderPipelineId, Extent3d, TextureFormat, TextureView}, texture::ColorAttachment, }; -use bevy_utils::nonmax::NonMaxU32; +use nonmax::NonMaxU32; pub const NORMAL_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgb10a2Unorm; pub const MOTION_VECTOR_PREPASS_FORMAT: TextureFormat = TextureFormat::Rg16Float; diff --git a/crates/bevy_ecs/Cargo.toml b/crates/bevy_ecs/Cargo.toml index db804278b4b2f..27edd72384157 100644 --- a/crates/bevy_ecs/Cargo.toml +++ b/crates/bevy_ecs/Cargo.toml @@ -21,6 +21,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", optional = tr bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" } bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } bevy_ecs_macros = { path = "macros", version = "0.14.0-dev" } +petgraph = "0.6" bitflags = "2.3" concurrent-queue = "2.4.0" diff --git a/crates/bevy_ecs/src/lib.rs b/crates/bevy_ecs/src/lib.rs index 1f3464997bb04..4f2e00f5f747b 100644 --- a/crates/bevy_ecs/src/lib.rs +++ b/crates/bevy_ecs/src/lib.rs @@ -52,8 +52,6 @@ pub mod prelude { }; } -pub use bevy_utils::all_tuples; - #[cfg(test)] mod tests { use crate as bevy_ecs; diff --git a/crates/bevy_ecs/src/schedule/graph_utils.rs b/crates/bevy_ecs/src/schedule/graph_utils.rs index 04fb9a9ddda92..b5d10b08e1e2a 100644 --- a/crates/bevy_ecs/src/schedule/graph_utils.rs +++ b/crates/bevy_ecs/src/schedule/graph_utils.rs @@ -1,10 +1,8 @@ use std::fmt::Debug; -use bevy_utils::{ - petgraph::{algo::TarjanScc, graphmap::NodeTrait, prelude::*}, - HashMap, HashSet, -}; +use bevy_utils::{HashMap, HashSet}; use fixedbitset::FixedBitSet; +use petgraph::{algo::TarjanScc, graphmap::NodeTrait, prelude::*}; use crate::schedule::set::*; diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index 2244fffd09931..408fae9b1d615 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -7,13 +7,12 @@ use std::{ use bevy_utils::tracing::info_span; use bevy_utils::{default, tracing::info}; use bevy_utils::{ - petgraph::{algo::TarjanScc, prelude::*}, - thiserror::Error, tracing::{error, warn}, HashMap, HashSet, }; - use fixedbitset::FixedBitSet; +use petgraph::{algo::TarjanScc, prelude::*}; +use thiserror::Error; use crate::{ self as bevy_ecs, diff --git a/crates/bevy_ecs/src/schedule/stepping.rs b/crates/bevy_ecs/src/schedule/stepping.rs index b82fd6da76468..eb8b4699eb2b6 100644 --- a/crates/bevy_ecs/src/schedule/stepping.rs +++ b/crates/bevy_ecs/src/schedule/stepping.rs @@ -7,10 +7,10 @@ use crate::{ system::{IntoSystem, ResMut, Resource}, }; use bevy_utils::{ - thiserror::Error, tracing::{error, info, warn}, TypeIdMap, }; +use thiserror::Error; #[cfg(test)] use bevy_utils::tracing::debug; diff --git a/crates/bevy_gizmos/Cargo.toml b/crates/bevy_gizmos/Cargo.toml index 205759c974ee2..a7ecaddaf0b8b 100644 --- a/crates/bevy_gizmos/Cargo.toml +++ b/crates/bevy_gizmos/Cargo.toml @@ -23,11 +23,12 @@ bevy_math = { path = "../bevy_math", version = "0.14.0-dev" } bevy_asset = { path = "../bevy_asset", version = "0.14.0-dev" } bevy_render = { path = "../bevy_render", version = "0.14.0-dev" } bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } -bevy_core = { path = "../bevy_core", version = "0.14.0-dev" } bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev" } bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.14.0-dev" } bevy_transform = { path = "../bevy_transform", version = "0.14.0-dev" } bevy_gizmos_macros = { path = "macros", version = "0.14.0-dev" } +bytemuck = "1.0" + [lints] workspace = true diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 134bfd15514fa..a27b91192a2a3 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -57,7 +57,6 @@ use aabb::AabbGizmoPlugin; use bevy_app::{App, Last, Plugin}; use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle}; use bevy_color::LinearRgba; -use bevy_core::cast_slice; use bevy_ecs::{ component::Component, query::ROQueryItem, @@ -83,6 +82,7 @@ use bevy_render::{ Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; use bevy_utils::TypeIdMap; +use bytemuck::cast_slice; use config::{ DefaultGizmoConfigGroup, GizmoConfig, GizmoConfigGroup, GizmoConfigStore, GizmoMeshConfig, }; diff --git a/crates/bevy_gltf/Cargo.toml b/crates/bevy_gltf/Cargo.toml index e1a29899db8de..22c5f49450f76 100644 --- a/crates/bevy_gltf/Cargo.toml +++ b/crates/bevy_gltf/Cargo.toml @@ -54,6 +54,7 @@ base64 = "0.21.5" percent-encoding = "2.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1" +smallvec = "1.11" [lints] workspace = true diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index 276eb9f8f677f..b59d6eaf1fff5 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -36,10 +36,7 @@ use bevy_scene::Scene; use bevy_tasks::IoTaskPool; use bevy_transform::components::Transform; use bevy_utils::tracing::{error, info_span, warn}; -use bevy_utils::{ - smallvec::{smallvec, SmallVec}, - HashMap, HashSet, -}; +use bevy_utils::{HashMap, HashSet}; use gltf::{ accessor::Iter, mesh::{util::ReadIndices, Mode}, @@ -47,6 +44,7 @@ use gltf::{ Material, Node, Primitive, Semantic, }; use serde::{Deserialize, Serialize}; +use smallvec::{smallvec, SmallVec}; use std::io::Error; use std::{ collections::VecDeque, diff --git a/crates/bevy_hierarchy/Cargo.toml b/crates/bevy_hierarchy/Cargo.toml index ede2cabe6054c..342126e3f1976 100644 --- a/crates/bevy_hierarchy/Cargo.toml +++ b/crates/bevy_hierarchy/Cargo.toml @@ -21,8 +21,11 @@ bevy_core = { path = "../bevy_core", version = "0.14.0-dev", optional = true } bevy_ecs = { path = "../bevy_ecs", version = "0.14.0-dev", default-features = false } bevy_reflect = { path = "../bevy_reflect", version = "0.14.0-dev", features = [ "bevy", + "smallvec", ], optional = true } bevy_utils = { path = "../bevy_utils", version = "0.14.0-dev" } +smallvec = { version = "1.11", features = ["union", "const_generics"] } + [lints] workspace = true diff --git a/crates/bevy_hierarchy/src/child_builder.rs b/crates/bevy_hierarchy/src/child_builder.rs index b6ec13fe73372..f8d206dee5580 100644 --- a/crates/bevy_hierarchy/src/child_builder.rs +++ b/crates/bevy_hierarchy/src/child_builder.rs @@ -6,7 +6,7 @@ use bevy_ecs::{ system::{Commands, EntityCommands}, world::{Command, EntityWorldMut, World}, }; -use bevy_utils::smallvec::{smallvec, SmallVec}; +use smallvec::{smallvec, SmallVec}; // Do not use `world.send_event_batch` as it prints error message when the Events are not available in the world, // even though it's a valid use case to execute commands on a world without events. Loading a GLTF file for example @@ -696,7 +696,7 @@ mod tests { components::{Children, Parent}, HierarchyEvent::{self, ChildAdded, ChildMoved, ChildRemoved}, }; - use bevy_utils::smallvec::{smallvec, SmallVec}; + use smallvec::{smallvec, SmallVec}; use bevy_ecs::{ component::Component, diff --git a/crates/bevy_hierarchy/src/components/children.rs b/crates/bevy_hierarchy/src/components/children.rs index d980289abca79..5a53462d82c58 100644 --- a/crates/bevy_hierarchy/src/components/children.rs +++ b/crates/bevy_hierarchy/src/components/children.rs @@ -6,8 +6,8 @@ use bevy_ecs::{ prelude::FromWorld, world::World, }; -use bevy_utils::smallvec::SmallVec; use core::slice; +use smallvec::SmallVec; use std::ops::Deref; /// Contains references to the child entities of this entity. diff --git a/crates/bevy_pbr/Cargo.toml b/crates/bevy_pbr/Cargo.toml index 1e05323c85ca3..28e24aab94c70 100644 --- a/crates/bevy_pbr/Cargo.toml +++ b/crates/bevy_pbr/Cargo.toml @@ -40,6 +40,7 @@ fixedbitset = "0.4" bytemuck = { version = "1", features = ["derive"] } radsort = "0.1" smallvec = "1.6" +nonmax = "0.5" [lints] workspace = true diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 0b3c65ddfaf6c..061c34a8b2f3b 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -18,10 +18,8 @@ use bevy_render::{ use bevy_transform::{components::GlobalTransform, prelude::Transform}; #[cfg(feature = "trace")] use bevy_utils::tracing::info_span; -use bevy_utils::{ - nonmax::NonMaxU32, - tracing::{error, warn}, -}; +use bevy_utils::tracing::{error, warn}; +use nonmax::NonMaxU32; use std::{hash::Hash, num::NonZeroU64, ops::Range}; use crate::*; diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index fccab4f5cca03..3a197c692c4d9 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -10,12 +10,13 @@ keywords = ["bevy"] readme = "README.md" [features] -default = [] +default = ["smallvec"] # When enabled, provides Bevy-related reflection implementations bevy = ["smallvec", "bevy_math", "smol_str"] glam = ["dep:glam"] bevy_math = ["glam", "dep:bevy_math"] -smallvec = [] +smallvec = ["dep:smallvec"] +uuid = ["dep:uuid"] # When enabled, allows documentation comments to be accessed via reflection documentation = ["bevy_reflect_derive/documentation"] @@ -33,9 +34,11 @@ erased-serde = "0.4" downcast-rs = "1.2" thiserror = "1.0" serde = "1" +smallvec = { version = "1.11", optional = true } glam = { version = "0.25", features = ["serde"], optional = true } smol_str = { version = "0.2.0", optional = true } +uuid = { version = "1.0", optional = true, features = ["v4", "serde"] } [dev-dependencies] ron = "0.8.0" diff --git a/crates/bevy_reflect/src/impls/smallvec.rs b/crates/bevy_reflect/src/impls/smallvec.rs index a911b3b2fdc0e..b27c7a1e1ae9f 100644 --- a/crates/bevy_reflect/src/impls/smallvec.rs +++ b/crates/bevy_reflect/src/impls/smallvec.rs @@ -1,5 +1,4 @@ use bevy_reflect_derive::impl_type_path; -use bevy_utils::smallvec; use smallvec::SmallVec; use std::any::Any; @@ -154,7 +153,7 @@ where } } -impl_type_path!(::bevy_utils::smallvec::SmallVec); +impl_type_path!(::smallvec::SmallVec); impl FromReflect for SmallVec where diff --git a/crates/bevy_reflect/src/impls/uuid.rs b/crates/bevy_reflect/src/impls/uuid.rs index 27a1af41a4fc3..f845dda798c15 100644 --- a/crates/bevy_reflect/src/impls/uuid.rs +++ b/crates/bevy_reflect/src/impls/uuid.rs @@ -3,7 +3,7 @@ use crate as bevy_reflect; use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize}; use bevy_reflect_derive::impl_reflect_value; -impl_reflect_value!(::bevy_utils::Uuid( +impl_reflect_value!(::uuid::Uuid( Serialize, Deserialize, Default, diff --git a/crates/bevy_reflect/src/lib.rs b/crates/bevy_reflect/src/lib.rs index 52eae900d6d67..2add0144f0d04 100644 --- a/crates/bevy_reflect/src/lib.rs +++ b/crates/bevy_reflect/src/lib.rs @@ -500,6 +500,7 @@ mod impls { mod smol_str; mod std; + #[cfg(feature = "uuid")] mod uuid; } @@ -1547,7 +1548,6 @@ mod tests { // List (SmallVec) #[cfg(feature = "smallvec")] { - use bevy_utils::smallvec; type MySmallVec = smallvec::SmallVec<[String; 2]>; let info = MySmallVec::type_info(); diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 7e9012d99df3e..ca51b826c46c1 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -96,7 +96,8 @@ profiling = { version = "1", features = [ "profile-with-tracing", ], optional = true } async-channel = "2.2.0" - +nonmax = "0.5" +smallvec = "1.11" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Omit the `glsl` feature in non-WebAssembly by default. diff --git a/crates/bevy_render/src/batching/mod.rs b/crates/bevy_render/src/batching/mod.rs index 6f16617fe718a..54b0573081f67 100644 --- a/crates/bevy_render/src/batching/mod.rs +++ b/crates/bevy_render/src/batching/mod.rs @@ -4,7 +4,7 @@ use bevy_ecs::{ prelude::Res, system::{Query, ResMut, StaticSystemParam, SystemParam, SystemParamItem}, }; -use bevy_utils::nonmax::NonMaxU32; +use nonmax::NonMaxU32; use crate::{ render_phase::{CachedRenderPipelinePhaseItem, DrawFunctionId, RenderPhase}, diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index ae57a9a297c4e..dc4549cd040b5 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -11,7 +11,6 @@ use crate::{ renderer::RenderDevice, }; use bevy_asset::{Asset, Handle}; -use bevy_core::cast_slice; use bevy_derive::EnumVariantMeta; use bevy_ecs::system::{ lifetimeless::{SRes, SResMut}, @@ -19,8 +18,8 @@ use bevy_ecs::system::{ }; use bevy_math::*; use bevy_reflect::Reflect; -use bevy_utils::tracing::error; -use bevy_utils::tracing::warn; +use bevy_utils::tracing::{error, warn}; +use bytemuck::cast_slice; use std::{collections::BTreeMap, hash::Hash, iter::FusedIterator}; use thiserror::Error; use wgpu::{ diff --git a/crates/bevy_render/src/render_asset.rs b/crates/bevy_render/src/render_asset.rs index f4d6234aec5c3..0b1686fbce641 100644 --- a/crates/bevy_render/src/render_asset.rs +++ b/crates/bevy_render/src/render_asset.rs @@ -14,9 +14,10 @@ use bevy_reflect::{ ReflectFromReflect, ReflectKind, ReflectMut, ReflectOwned, ReflectRef, ReflectSerialize, TypeInfo, TypePath, TypeRegistration, Typed, ValueInfo, }; -use bevy_utils::{thiserror::Error, HashMap, HashSet}; +use bevy_utils::{HashMap, HashSet}; use serde::{Deserialize, Serialize}; use std::marker::PhantomData; +use thiserror::Error; #[derive(Debug, Error)] pub enum PrepareAssetError { diff --git a/crates/bevy_render/src/render_phase/mod.rs b/crates/bevy_render/src/render_phase/mod.rs index e66698fc371d9..1a3a544b464f4 100644 --- a/crates/bevy_render/src/render_phase/mod.rs +++ b/crates/bevy_render/src/render_phase/mod.rs @@ -29,9 +29,9 @@ mod draw; mod draw_state; mod rangefinder; -use bevy_utils::nonmax::NonMaxU32; pub use draw::*; pub use draw_state::*; +use nonmax::NonMaxU32; pub use rangefinder::*; use crate::render_resource::{CachedRenderPipelineId, PipelineCache}; diff --git a/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs b/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs index cb81152ee5147..d92c7a3897e06 100644 --- a/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs +++ b/crates/bevy_render/src/render_resource/batched_uniform_buffer.rs @@ -3,11 +3,11 @@ use crate::{ render_resource::DynamicUniformBuffer, renderer::{RenderDevice, RenderQueue}, }; -use bevy_utils::nonmax::NonMaxU32; use encase::{ private::{ArrayMetadata, BufferMut, Metadata, RuntimeSizedArray, WriteInto, Writer}, ShaderType, }; +use nonmax::NonMaxU32; use std::{marker::PhantomData, num::NonZeroU64}; use wgpu::{BindingResource, Limits}; diff --git a/crates/bevy_render/src/render_resource/bind_group.rs b/crates/bevy_render/src/render_resource/bind_group.rs index 4e6898b7cb1c4..96f885f8e9c1d 100644 --- a/crates/bevy_render/src/render_resource/bind_group.rs +++ b/crates/bevy_render/src/render_resource/bind_group.rs @@ -7,9 +7,9 @@ use crate::{ texture::FallbackImage, }; pub use bevy_render_macros::AsBindGroup; -use bevy_utils::thiserror::Error; use encase::ShaderType; use std::ops::Deref; +use thiserror::Error; use wgpu::{BindGroupEntry, BindGroupLayoutEntry, BindingResource}; define_atomic_id!(BindGroupId); diff --git a/crates/bevy_render/src/render_resource/buffer_vec.rs b/crates/bevy_render/src/render_resource/buffer_vec.rs index cae1ef4f05381..26656c58ed983 100644 --- a/crates/bevy_render/src/render_resource/buffer_vec.rs +++ b/crates/bevy_render/src/render_resource/buffer_vec.rs @@ -2,7 +2,7 @@ use crate::{ render_resource::Buffer, renderer::{RenderDevice, RenderQueue}, }; -use bevy_core::{cast_slice, Pod}; +use bytemuck::{cast_slice, Pod}; use wgpu::BufferUsages; /// A structure for storing raw bytes that have already been properly formatted diff --git a/crates/bevy_render/src/render_resource/gpu_array_buffer.rs b/crates/bevy_render/src/render_resource/gpu_array_buffer.rs index 1d314f0a1da7c..60d8cc68e400c 100644 --- a/crates/bevy_render/src/render_resource/gpu_array_buffer.rs +++ b/crates/bevy_render/src/render_resource/gpu_array_buffer.rs @@ -7,8 +7,8 @@ use crate::{ renderer::{RenderDevice, RenderQueue}, }; use bevy_ecs::{prelude::Component, system::Resource}; -use bevy_utils::nonmax::NonMaxU32; use encase::{private::WriteInto, ShaderSize, ShaderType}; +use nonmax::NonMaxU32; use std::marker::PhantomData; use wgpu::BindingResource; diff --git a/crates/bevy_render/src/renderer/graph_runner.rs b/crates/bevy_render/src/renderer/graph_runner.rs index 3db56919b1247..c155f4027da46 100644 --- a/crates/bevy_render/src/renderer/graph_runner.rs +++ b/crates/bevy_render/src/renderer/graph_runner.rs @@ -1,11 +1,9 @@ use bevy_ecs::{prelude::Entity, world::World}; #[cfg(feature = "trace")] use bevy_utils::tracing::info_span; -use bevy_utils::{ - smallvec::{smallvec, SmallVec}, - HashMap, -}; +use bevy_utils::HashMap; +use smallvec::{smallvec, SmallVec}; use std::{borrow::Cow, collections::VecDeque}; use thiserror::Error; diff --git a/crates/bevy_render/src/texture/image_texture_conversion.rs b/crates/bevy_render/src/texture/image_texture_conversion.rs index 41090adfc0d0d..d5bbed5ee6c87 100644 --- a/crates/bevy_render/src/texture/image_texture_conversion.rs +++ b/crates/bevy_render/src/texture/image_texture_conversion.rs @@ -13,7 +13,7 @@ impl Image { is_srgb: bool, asset_usage: RenderAssetUsages, ) -> Image { - use bevy_core::cast_slice; + use bytemuck::cast_slice; let width; let height; diff --git a/crates/bevy_ui/Cargo.toml b/crates/bevy_ui/Cargo.toml index a417a5bfac8e0..b83a227e99d8d 100644 --- a/crates/bevy_ui/Cargo.toml +++ b/crates/bevy_ui/Cargo.toml @@ -35,9 +35,11 @@ taffy = { version = "0.3.10" } serde = { version = "1", features = ["derive"], optional = true } bytemuck = { version = "1.5", features = ["derive"] } thiserror = "1.0.0" +nonmax = "0.5" +smallvec = "1.11" [features] -serialize = ["serde"] +serialize = ["serde", "smallvec/serde"] [lints] workspace = true diff --git a/crates/bevy_ui/src/focus.rs b/crates/bevy_ui/src/focus.rs index 6becec74be2cc..08d488de34bb9 100644 --- a/crates/bevy_ui/src/focus.rs +++ b/crates/bevy_ui/src/focus.rs @@ -12,10 +12,11 @@ use bevy_math::{Rect, Vec2}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{camera::NormalizedRenderTarget, prelude::Camera, view::ViewVisibility}; use bevy_transform::components::GlobalTransform; - -use bevy_utils::{smallvec::SmallVec, HashMap}; +use bevy_utils::HashMap; use bevy_window::{PrimaryWindow, Window}; +use smallvec::SmallVec; + #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; diff --git a/crates/bevy_ui/src/render/render_pass.rs b/crates/bevy_ui/src/render/render_pass.rs index e0119509d7b27..1f3ffb0d20dea 100644 --- a/crates/bevy_ui/src/render/render_pass.rs +++ b/crates/bevy_ui/src/render/render_pass.rs @@ -14,7 +14,8 @@ use bevy_render::{ renderer::*, view::*, }; -use bevy_utils::{nonmax::NonMaxU32, FloatOrd}; +use bevy_utils::FloatOrd; +use nonmax::NonMaxU32; pub struct UiPassNode { ui_view_query: QueryState< diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index e8051aff651d6..36db16ca60614 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -9,8 +9,9 @@ use bevy_render::{ texture::Image, }; use bevy_transform::prelude::GlobalTransform; -use bevy_utils::{smallvec::SmallVec, warn_once}; +use bevy_utils::warn_once; use bevy_window::{PrimaryWindow, WindowRef}; +use smallvec::SmallVec; use std::num::{NonZeroI16, NonZeroU16}; use thiserror::Error; diff --git a/crates/bevy_utils/Cargo.toml b/crates/bevy_utils/Cargo.toml index d9165cb5bb927..88fe6dc0a574c 100644 --- a/crates/bevy_utils/Cargo.toml +++ b/crates/bevy_utils/Cargo.toml @@ -15,14 +15,9 @@ detailed_trace = [] ahash = "0.8.7" tracing = { version = "0.1", default-features = false, features = ["std"] } web-time = { version = "0.2" } -uuid = { version = "1.1", features = ["v4", "serde"] } hashbrown = { version = "0.14", features = ["serde"] } bevy_utils_proc_macros = { version = "0.14.0-dev", path = "macros" } -petgraph = "0.6" -thiserror = "1.0" thread_local = "1.0" -nonmax = "0.5" -smallvec = { version = "1.11", features = ["serde", "union", "const_generics"] } [dev-dependencies] static_assertions = "1.1.0" diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 66e7336a4236b..33f5312171041 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -15,8 +15,6 @@ pub use short_names::get_short_name; pub mod synccell; pub mod syncunsafecell; -pub mod uuid; - mod cow_arc; mod default; mod float_ord; @@ -24,7 +22,6 @@ pub mod intern; mod once; mod parallel_queue; -pub use crate::uuid::Uuid; pub use ahash::{AHasher, RandomState}; pub use bevy_utils_proc_macros::*; pub use cow_arc::*; @@ -32,17 +29,9 @@ pub use default::default; pub use float_ord::*; pub use hashbrown; pub use parallel_queue::*; -pub use petgraph; -pub use smallvec; -pub use thiserror; pub use tracing; pub use web_time::{Duration, Instant, SystemTime, SystemTimeError, TryFromFloatSecsError}; -#[allow(missing_docs)] -pub mod nonmax { - pub use nonmax::*; -} - use hashbrown::hash_map::RawEntryMut; use std::{ any::TypeId, diff --git a/crates/bevy_utils/src/uuid.rs b/crates/bevy_utils/src/uuid.rs deleted file mode 100644 index 3542c9411eee0..0000000000000 --- a/crates/bevy_utils/src/uuid.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! UUID utilities. -//! -//! This module re-exports the [`Uuid`] type from the [`uuid`] crate, -//! and provides additional utility functions. -//! -//! [`uuid`]: uuid - -pub use ::uuid::Uuid; - -/// Generates a new UUID from the given UUIDs `a` and `b`, -/// where the bytes are generated by a bitwise `a ^ b.rotate_right(1)`. -/// -/// The generated UUID will be a `UUIDv4` -/// (meaning that the bytes should be random, not e.g. derived from the system time). -#[allow(clippy::unusual_byte_groupings)] // unusual byte grouping is meant to signal the relevant bits -pub const fn generate_composite_uuid(a: Uuid, b: Uuid) -> Uuid { - let mut new = [0; 16]; - let mut i = 0; - while i < new.len() { - // rotating ensures different uuids for A> and B> because: A ^ (B ^ C) = B ^ (A ^ C) - // notice that you have to rotate the second parameter: A.rr ^ (B.rr ^ C) = B.rr ^ (A.rr ^ C) - // Solution: A ^ (B ^ C.rr).rr != B ^ (A ^ C.rr).rr - new[i] = a.as_bytes()[i] ^ b.as_bytes()[i].rotate_right(1); - - i += 1; - } - - // Version: the most significant 4 bits in the 6th byte: 11110000 - new[6] = new[6] & 0b0000_1111 | 0b0100_0000; // set version to v4 - - // Variant: the most significant 3 bits in the 8th byte: 11100000 - new[8] = new[8] & 0b000_11111 | 0b100_00000; // set variant to rfc4122 - - Uuid::from_bytes(new) -} diff --git a/examples/asset/asset_decompression.rs b/examples/asset/asset_decompression.rs index 1c72521b0eb7a..cd17a38a89a9e 100644 --- a/examples/asset/asset_decompression.rs +++ b/examples/asset/asset_decompression.rs @@ -1,6 +1,5 @@ //! Implements loader for a Gzip compressed asset. -use bevy::utils::thiserror; use bevy::{ asset::{ io::{Reader, VecReader}, diff --git a/examples/asset/custom_asset.rs b/examples/asset/custom_asset.rs index f54a1d3a19e55..c10e297c380bd 100644 --- a/examples/asset/custom_asset.rs +++ b/examples/asset/custom_asset.rs @@ -1,6 +1,5 @@ //! Implements loader for a custom asset type. -use bevy::utils::thiserror; use bevy::{ asset::{io::Reader, ron, AssetLoader, AsyncReadExt, LoadContext}, prelude::*, diff --git a/examples/asset/processing/asset_processing.rs b/examples/asset/processing/asset_processing.rs index 640d0cdabf369..3f660ef85f500 100644 --- a/examples/asset/processing/asset_processing.rs +++ b/examples/asset/processing/asset_processing.rs @@ -12,7 +12,7 @@ use bevy::{ }, prelude::*, reflect::TypePath, - utils::{thiserror, BoxedFuture}, + utils::BoxedFuture, }; use serde::{Deserialize, Serialize}; use std::convert::Infallible; diff --git a/examples/games/contributors.rs b/examples/games/contributors.rs index 52dadf9766652..067f0bdf58b20 100644 --- a/examples/games/contributors.rs +++ b/examples/games/contributors.rs @@ -1,10 +1,6 @@ //! This example displays each contributor to the bevy source code as a bouncing bevy-ball. -use bevy::{ - math::bounding::Aabb2d, - prelude::*, - utils::{thiserror, HashMap}, -}; +use bevy::{math::bounding::Aabb2d, prelude::*, utils::HashMap}; use rand::{prelude::SliceRandom, Rng}; use std::{ env::VarError,