Skip to content

Commit

Permalink
Move all_tuples to a new crate (#16161)
Browse files Browse the repository at this point in the history
# Objective

Fixes #15941

## Solution

Created https://crates.io/crates/variadics_please and moved the code
there; updating references

`bevy_utils/macros` is deleted.

## Testing

cargo check

## Migration Guide

Use `variadics_please::{all_tuples, all_tuples_with_size}` instead of
`bevy::utils::{all_tuples, all_tuples_with_size}`.
  • Loading branch information
BenjaminBrienen authored Dec 3, 2024
1 parent 2e267bb commit afd0f13
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 447 deletions.
1 change: 1 addition & 0 deletions crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ derive_more = { version = "1", default-features = false, features = [
"from",
"display",
] }
variadics_please = "1.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ctrlc = "3.4.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub trait Plugins<Marker>: sealed::Plugins<Marker> {}
impl<Marker, T> Plugins<Marker> for T where T: sealed::Plugins<Marker> {}

mod sealed {
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use crate::{App, AppError, Plugin, PluginGroup};

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ derive_more = { version = "1", default-features = false, features = [
nonmax = "0.5"
arrayvec = { version = "0.7.4", optional = true }
smallvec = { version = "1", features = ["union"] }
variadics_please = "1.0"

[dev-dependencies]
rand = "0.8"
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ use crate::{
world::{unsafe_world_cell::UnsafeWorldCell, ON_ADD, ON_INSERT, ON_REPLACE},
};
use bevy_ptr::{ConstNonNull, OwningPtr};
use bevy_utils::{all_tuples, HashMap, HashSet, TypeIdMap};
use bevy_utils::{HashMap, HashSet, TypeIdMap};
#[cfg(feature = "track_change_detection")]
use core::panic::Location;
use core::{any::TypeId, ptr::NonNull};
use variadics_please::all_tuples;

/// The `Bundle` trait enables insertion and removal of [`Component`]s from an entity.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/query/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use crate::{
},
};
use bevy_ptr::{ThinSlicePtr, UnsafeCellDeref};
use bevy_utils::all_tuples;
use core::{cell::UnsafeCell, marker::PhantomData};
use smallvec::SmallVec;
use variadics_please::all_tuples;

/// Types that can be fetched from a [`World`] using a [`Query`].
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/query/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::{
world::{unsafe_world_cell::UnsafeWorldCell, World},
};
use bevy_ptr::{ThinSlicePtr, UnsafeCellDeref};
use bevy_utils::all_tuples;
use core::{cell::UnsafeCell, marker::PhantomData};
use variadics_please::all_tuples;

/// Types that filter the results of a [`Query`].
///
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/query/world_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
storage::{Table, TableRow},
world::{unsafe_world_cell::UnsafeWorldCell, World},
};
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

/// Types that can be used as parameters in a [`Query`].
/// Types that implement this should also implement either [`QueryData`] or [`QueryFilter`]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/schedule/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use crate::{
schedule::{
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/system/builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy_utils::{all_tuples, synccell::SyncCell};
use bevy_utils::synccell::SyncCell;
use variadics_please::all_tuples;

use crate::{
prelude::QueryBuilder,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/exclusive_function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::{
};

use alloc::borrow::Cow;
use bevy_utils::all_tuples;
use core::marker::PhantomData;
use variadics_please::all_tuples;

/// A function system that runs with exclusive [`World`] access.
///
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/system/exclusive_system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use crate::{
system::{Local, SystemMeta, SystemParam, SystemState},
world::World,
};
use bevy_utils::{all_tuples, synccell::SyncCell};
use bevy_utils::synccell::SyncCell;
use core::marker::PhantomData;
use variadics_please::all_tuples;

/// A parameter that can be used in an exclusive system (a system with an `&mut World` parameter).
/// Any parameters implementing this trait must come after the `&mut World` parameter.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::{
};

use alloc::borrow::Cow;
use bevy_utils::all_tuples;
use core::marker::PhantomData;
use variadics_please::all_tuples;

#[cfg(feature = "trace")]
use bevy_utils::tracing::{info_span, Span};
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{
use bevy_ecs_macros::impl_param_set;
pub use bevy_ecs_macros::{Resource, SystemParam};
use bevy_ptr::UnsafeCellDeref;
use bevy_utils::{all_tuples, synccell::SyncCell};
use bevy_utils::synccell::SyncCell;
#[cfg(feature = "track_change_detection")]
use core::panic::Location;
use core::{
Expand All @@ -30,6 +30,7 @@ use core::{
};

use super::Populated;
use variadics_please::all_tuples;

/// A parameter that can be used in a [`System`](super::System).
///
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ glam = { version = "0.29", features = ["serde"], optional = true }
petgraph = { version = "0.6", features = ["serde-1"], optional = true }
smol_str = { version = "0.2.0", features = ["serde"], optional = true }
uuid = { version = "1.0", optional = true, features = ["v4", "serde"] }
variadics_please = "1.0"
wgpu-types = { version = "23", features = ["serde"], optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/func/info.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::borrow::Cow;

use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use crate::{
func::args::{ArgInfo, GetOwnership, Ownership},
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/func/reflect_fn.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use crate::{
func::{
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/func/reflect_fn_mut.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use crate::{
func::{
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/tuple.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bevy_reflect_derive::impl_type_path;
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use crate::generics::impl_generic_info_methods;
use crate::{
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ async-channel = "2.3.0"
nonmax = "0.5"
smallvec = { version = "1.11", features = ["const_new"] }
offset-allocator = "0.2"
variadics_please = "1.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Omit the `glsl` feature in non-WebAssembly by default.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_graph/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use bevy_ecs::{
query::{QueryItem, QueryState, ReadOnlyQueryData},
world::{FromWorld, World},
};
use bevy_utils::all_tuples_with_size;
use core::fmt::Debug;
use derive_more::derive::{Display, Error, From};
use downcast_rs::{impl_downcast, Downcast};
use variadics_please::all_tuples_with_size;

pub use bevy_render_macros::RenderLabel;

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_render/src/render_phase/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use bevy_ecs::{
system::{ReadOnlySystemParam, Resource, SystemParam, SystemParamItem, SystemState},
world::World,
};
use bevy_utils::{all_tuples, TypeIdMap};
use bevy_utils::TypeIdMap;
use core::{any::TypeId, fmt::Debug, hash::Hash};
use derive_more::derive::{Display, Error};
use std::sync::{PoisonError, RwLock, RwLockReadGuard, RwLockWriteGuard};
use variadics_please::all_tuples;

/// A draw function used to draw [`PhaseItem`]s.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy_utils::all_tuples_with_size;
use variadics_please::all_tuples_with_size;
use wgpu::{BindGroupEntry, BindingResource};

use super::{Sampler, TextureView};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bevy_utils::all_tuples_with_size;
use core::num::NonZero;
use variadics_please::all_tuples_with_size;
use wgpu::{BindGroupLayoutEntry, BindingType, ShaderStages};

/// Helper for constructing bind group layouts.
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", optional = true }
bevy_app = { path = "../bevy_app", version = "0.15.0-dev", optional = true }
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev", optional = true }
variadics_please = "1.0"

[lints]
workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_state/src/state/state_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_ecs::{
schedule::{IntoSystemConfigs, IntoSystemSetConfigs, Schedule},
system::{Commands, IntoSystem, Res, ResMut},
};
use bevy_utils::all_tuples;
use variadics_please::all_tuples;

use self::sealed::StateSetSealed;

Expand Down
1 change: 0 additions & 1 deletion crates/bevy_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ ahash = { version = "0.8.7", default-features = false, features = [
] }
tracing = { version = "0.1", default-features = false }
hashbrown = { version = "0.14.2", default-features = false }
bevy_utils_proc_macros = { version = "0.15.0-dev", path = "macros" }
thread_local = { version = "1.0", optional = true }

[dev-dependencies]
Expand Down
22 changes: 0 additions & 22 deletions crates/bevy_utils/macros/Cargo.toml

This file was deleted.

Loading

0 comments on commit afd0f13

Please sign in to comment.