From 96a0a9c0859211c4fbdb43170738bab960e4ce4a Mon Sep 17 00:00:00 2001 From: Mike Hsu Date: Tue, 21 Nov 2023 20:33:41 -0800 Subject: [PATCH] delete methods deprecated in 0.12 --- crates/bevy_app/src/app.rs | 11 -- crates/bevy_ecs/src/event.rs | 40 ----- crates/bevy_ecs/src/query/par_iter.rs | 13 -- crates/bevy_ecs/src/removal_detection.rs | 14 -- crates/bevy_ecs/src/schedule/schedule.rs | 7 - crates/bevy_ecs/src/system/mod.rs | 220 ----------------------- crates/bevy_reflect/src/reflect.rs | 18 -- 7 files changed, 323 deletions(-) diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index ee2b431996fee2..a169cda57fca80 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -421,17 +421,6 @@ impl App { self } - /// Configures a system set in the default schedule, adding the set if it does not exist. - #[deprecated(since = "0.12.0", note = "Please use `configure_sets` instead.")] - #[track_caller] - pub fn configure_set( - &mut self, - schedule: impl ScheduleLabel, - set: impl IntoSystemSetConfigs, - ) -> &mut Self { - self.configure_sets(schedule, set) - } - /// Configures a collection of system sets in the default schedule, adding any sets that do not exist. #[track_caller] pub fn configure_sets( diff --git a/crates/bevy_ecs/src/event.rs b/crates/bevy_ecs/src/event.rs index 222c6101ceee43..d112b7d57686fb 100644 --- a/crates/bevy_ecs/src/event.rs +++ b/crates/bevy_ecs/src/event.rs @@ -421,25 +421,11 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> { self.reader.read(&self.events) } - /// Iterates over the events this [`EventReader`] has not seen yet. This updates the - /// [`EventReader`]'s event counter, which means subsequent event reads will not include events - /// that happened before now. - #[deprecated = "use `.read()` instead."] - pub fn iter(&mut self) -> EventIterator<'_, E> { - self.reader.read(&self.events) - } - /// Like [`read`](Self::read), except also returning the [`EventId`] of the events. pub fn read_with_id(&mut self) -> EventIteratorWithId<'_, E> { self.reader.read_with_id(&self.events) } - /// Like [`iter`](Self::iter), except also returning the [`EventId`] of the events. - #[deprecated = "use `.read_with_id() instead."] - pub fn iter_with_id(&mut self) -> EventIteratorWithId<'_, E> { - self.reader.read_with_id(&self.events) - } - /// Determines the number of events available to be read from this [`EventReader`] without consuming any. pub fn len(&self) -> usize { self.reader.len(&self.events) @@ -583,23 +569,11 @@ impl ManualEventReader { self.read_with_id(events).without_id() } - /// See [`EventReader::iter`] - #[deprecated = "use `.read()` instead."] - pub fn iter<'a>(&'a mut self, events: &'a Events) -> EventIterator<'a, E> { - self.read_with_id(events).without_id() - } - /// See [`EventReader::read_with_id`] pub fn read_with_id<'a>(&'a mut self, events: &'a Events) -> EventIteratorWithId<'a, E> { EventIteratorWithId::new(self, events) } - /// See [`EventReader::iter_with_id`] - #[deprecated = "use `.read_with_id() instead."] - pub fn iter_with_id<'a>(&'a mut self, events: &'a Events) -> EventIteratorWithId<'a, E> { - EventIteratorWithId::new(self, events) - } - /// See [`EventReader::len`] pub fn len(&self, events: &Events) -> usize { // The number of events in this reader is the difference between the most recent event @@ -636,13 +610,6 @@ pub struct EventIterator<'a, E: Event> { iter: EventIteratorWithId<'a, E>, } -/// An iterator that yields any unread events from an [`EventReader`] or [`ManualEventReader`]. -/// -/// This is a type alias for [`EventIterator`], which used to be called `ManualEventIterator`. -/// This type alias will be removed in the next release of bevy, so you should use [`EventIterator`] directly instead. -#[deprecated = "This type has been renamed to `EventIterator`."] -pub type ManualEventIterator<'a, E> = EventIterator<'a, E>; - impl<'a, E: Event> Iterator for EventIterator<'a, E> { type Item = &'a E; fn next(&mut self) -> Option { @@ -683,13 +650,6 @@ pub struct EventIteratorWithId<'a, E: Event> { unread: usize, } -/// An iterator that yields any unread events (and their IDs) from an [`EventReader`] or [`ManualEventReader`]. -/// -/// This is a type alias for [`EventIteratorWithId`], which used to be called `ManualEventIteratorWithId`. -/// This type alias will be removed in the next release of bevy, so you should use [`EventIteratorWithId`] directly instead. -#[deprecated = "This type has been renamed to `EventIteratorWithId`."] -pub type ManualEventIteratorWithId<'a, E> = EventIteratorWithId<'a, E>; - impl<'a, E: Event> EventIteratorWithId<'a, E> { /// Creates a new iterator that yields any `events` that have not yet been seen by `reader`. pub fn new(reader: &'a mut ManualEventReader, events: &'a Events) -> Self { diff --git a/crates/bevy_ecs/src/query/par_iter.rs b/crates/bevy_ecs/src/query/par_iter.rs index 97165883694f8c..1454b6ef516484 100644 --- a/crates/bevy_ecs/src/query/par_iter.rs +++ b/crates/bevy_ecs/src/query/par_iter.rs @@ -156,19 +156,6 @@ impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> QueryParIter<'w, 's, Q, F> { } } - /// Runs `func` on each query result in parallel. - /// - /// # Panics - /// If the [`ComputeTaskPool`] is not initialized. If using this from a query that is being - /// initialized and run from the ECS scheduler, this should never panic. - /// - /// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool - #[inline] - #[deprecated = "use `.for_each(...)` instead."] - pub fn for_each_mut) + Send + Sync + Clone>(self, func: FN) { - self.for_each(func); - } - #[cfg(all(not(target = "wasm32"), feature = "multi-threaded"))] fn get_batch_size(&self, thread_count: usize) -> usize { if self.batching_strategy.batch_size_limits.is_empty() { diff --git a/crates/bevy_ecs/src/removal_detection.rs b/crates/bevy_ecs/src/removal_detection.rs index 26f8fd1c53ec0d..671cf1562dd001 100644 --- a/crates/bevy_ecs/src/removal_detection.rs +++ b/crates/bevy_ecs/src/removal_detection.rs @@ -208,14 +208,6 @@ impl<'w, 's, T: Component> RemovedComponents<'w, 's, T> { .map(RemovedComponentEntity::into) } - /// Iterates over the events this [`RemovedComponents`] has not seen yet. This updates the - /// [`RemovedComponents`]'s event counter, which means subsequent event reads will not include events - /// that happened before now. - #[deprecated = "use `.read()` instead."] - pub fn iter(&mut self) -> RemovedIter<'_> { - self.read() - } - /// Like [`read`](Self::read), except also returning the [`EventId`] of the events. pub fn read_with_id(&mut self) -> RemovedIterWithId<'_> { self.reader_mut_with_events() @@ -225,12 +217,6 @@ impl<'w, 's, T: Component> RemovedComponents<'w, 's, T> { .map(map_id_events) } - /// Like [`iter`](Self::iter), except also returning the [`EventId`] of the events. - #[deprecated = "use `.read_with_id()` instead."] - pub fn iter_with_id(&mut self) -> RemovedIterWithId<'_> { - self.read_with_id() - } - /// Determines the number of removal events available to be read from this [`RemovedComponents`] without consuming any. pub fn len(&self) -> usize { self.events() diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs index 8d65f61119e617..c5012f8f1491bc 100644 --- a/crates/bevy_ecs/src/schedule/schedule.rs +++ b/crates/bevy_ecs/src/schedule/schedule.rs @@ -232,13 +232,6 @@ impl Schedule { self } - /// Configures a system set in this schedule, adding it if it does not exist. - #[deprecated(since = "0.12.0", note = "Please use `configure_sets` instead.")] - #[track_caller] - pub fn configure_set(&mut self, set: impl IntoSystemSetConfigs) -> &mut Self { - self.configure_sets(set) - } - /// Configures a collection of system sets in this schedule, adding them if they does not exist. #[track_caller] pub fn configure_sets(&mut self, sets: impl IntoSystemSetConfigs) -> &mut Self { diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index a8578ae3d43572..c50798d6230975 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -232,226 +232,6 @@ impl IntoSystem for T { /// ``` pub struct In(pub In); -/// A collection of common adapters for [piping](crate::system::PipeSystem) the result of a system. -#[deprecated = "this form of system adapter has been deprecated in favor of `system.map(...)`"] -pub mod adapter { - use crate::system::In; - use bevy_utils::tracing; - use std::fmt::Debug; - - /// Converts a regular function into a system adapter. - /// - /// # Examples - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// fn return1() -> u64 { 1 } - /// - /// return1 - /// .pipe(system_adapter::new(u32::try_from)) - /// .pipe(system_adapter::unwrap) - /// .pipe(print); - /// - /// fn print(In(x): In) { - /// println!("{x:?}"); - /// } - /// ``` - #[deprecated = "use `.map(...)` instead"] - pub fn new(mut f: impl FnMut(T) -> U) -> impl FnMut(In) -> U { - move |In(x)| f(x) - } - - /// System adapter that unwraps the `Ok` variant of a [`Result`]. - /// This is useful for fallible systems that should panic in the case of an error. - /// - /// There is no equivalent adapter for [`Option`]. Instead, it's best to provide - /// an error message and convert to a `Result` using `ok_or{_else}`. - /// - /// # Examples - /// - /// Panicking on error - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// // Building a new schedule/app... - /// let mut sched = Schedule::default(); - /// sched.add_systems( - /// // Panic if the load system returns an error. - /// load_save_system.pipe(system_adapter::unwrap) - /// ) - /// // ... - /// # ; - /// # let mut world = World::new(); - /// # sched.run(&mut world); - /// - /// // A system which may fail irreparably. - /// fn load_save_system() -> Result<(), std::io::Error> { - /// let save_file = open_file("my_save.json")?; - /// dbg!(save_file); - /// Ok(()) - /// } - /// # fn open_file(name: &str) -> Result<&'static str, std::io::Error> - /// # { Ok("hello world") } - /// ``` - #[deprecated = "use `.map(Result::unwrap)` instead"] - pub fn unwrap(In(res): In>) -> T { - res.unwrap() - } - - /// System adapter that utilizes the [`bevy_utils::tracing::info!`] macro to print system information. - /// - /// # Examples - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// // Building a new schedule/app... - /// let mut sched = Schedule::default(); - /// sched.add_systems( - /// // Prints system information. - /// data_pipe_system.pipe(system_adapter::info) - /// ) - /// // ... - /// # ; - /// # let mut world = World::new(); - /// # sched.run(&mut world); - /// - /// // A system that returns a String output. - /// fn data_pipe_system() -> String { - /// "42".to_string() - /// } - /// ``` - #[deprecated = "use `.map(bevy_utils::info)` instead"] - pub fn info(In(data): In) { - tracing::info!("{:?}", data); - } - - /// System adapter that utilizes the [`bevy_utils::tracing::debug!`] macro to print the output of a system. - /// - /// # Examples - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// // Building a new schedule/app... - /// let mut sched = Schedule::default(); - /// sched.add_systems( - /// // Prints debug data from system. - /// parse_message_system.pipe(system_adapter::dbg) - /// ) - /// // ... - /// # ; - /// # let mut world = World::new(); - /// # sched.run(&mut world); - /// - /// // A system that returns a Result output. - /// fn parse_message_system() -> Result { - /// Ok("42".parse()?) - /// } - /// ``` - #[deprecated = "use `.map(bevy_utils::dbg)` instead"] - pub fn dbg(In(data): In) { - tracing::debug!("{:?}", data); - } - - /// System adapter that utilizes the [`bevy_utils::tracing::warn!`] macro to print the output of a system. - /// - /// # Examples - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// // Building a new schedule/app... - /// # let mut sched = Schedule::default(); - /// sched.add_systems( - /// // Prints system warning if system returns an error. - /// warning_pipe_system.pipe(system_adapter::warn) - /// ) - /// // ... - /// # ; - /// # let mut world = World::new(); - /// # sched.run(&mut world); - /// - /// // A system that returns a Result<(), String> output. - /// fn warning_pipe_system() -> Result<(), String> { - /// Err("Got to rusty?".to_string()) - /// } - /// ``` - #[deprecated = "use `.map(bevy_utils::warn)` instead"] - pub fn warn(In(res): In>) { - if let Err(warn) = res { - tracing::warn!("{:?}", warn); - } - } - - /// System adapter that utilizes the [`bevy_utils::tracing::error!`] macro to print the output of a system. - /// - /// # Examples - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// // Building a new schedule/app... - /// let mut sched = Schedule::default(); - /// sched.add_systems( - /// // Prints system error if system fails. - /// parse_error_message_system.pipe(system_adapter::error) - /// ) - /// // ... - /// # ; - /// # let mut world = World::new(); - /// # sched.run(&mut world); - /// - /// // A system that returns a Result<())> output. - /// fn parse_error_message_system() -> Result<(), String> { - /// Err("Some error".to_owned()) - /// } - /// ``` - #[deprecated = "use `.map(bevy_utils::error)` instead"] - pub fn error(In(res): In>) { - if let Err(error) = res { - tracing::error!("{:?}", error); - } - } - - /// System adapter that ignores the output of the previous system in a pipe. - /// This is useful for fallible systems that should simply return early in case of an `Err`/`None`. - /// - /// # Examples - /// - /// Returning early - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// // Marker component for an enemy entity. - /// #[derive(Component)] - /// struct Monster; - /// - /// // Building a new schedule/app... - /// # let mut sched = Schedule::default(); sched - /// .add_systems( - /// // If the system fails, just move on and try again next frame. - /// fallible_system.pipe(system_adapter::ignore) - /// ) - /// // ... - /// # ; - /// # let mut world = World::new(); - /// # sched.run(&mut world); - /// - /// // A system which may return early. It's more convenient to use the `?` operator for this. - /// fn fallible_system( - /// q: Query> - /// ) -> Option<()> { - /// let monster_id = q.iter().next()?; - /// println!("Monster entity is {monster_id:?}"); - /// Some(()) - /// } - /// ``` - #[deprecated = "use `.map(std::mem::drop)` instead"] - pub fn ignore(In(_): In) {} -} - /// Ensure that a given function is a [system](System). /// /// This should be used when writing doc examples, diff --git a/crates/bevy_reflect/src/reflect.rs b/crates/bevy_reflect/src/reflect.rs index d36fd5db94f216..458022566baa5f 100644 --- a/crates/bevy_reflect/src/reflect.rs +++ b/crates/bevy_reflect/src/reflect.rs @@ -73,24 +73,6 @@ pub enum ReflectOwned { /// [derive macro]: bevy_reflect_derive::Reflect /// [crate-level documentation]: crate pub trait Reflect: DynamicTypePath + Any + Send + Sync { - /// Returns the type path of the underlying type. - /// - /// This type path will either be found through [`get_represented_type_info`] - /// or taken from a [`TypePath`] implementation if the former isn't available. - /// - /// This method is deprecated; please consider migrating to one of the above methods. - /// - /// [`get_represented_type_info`]: Reflect::get_represented_type_info - #[deprecated( - since = "0.12.0", - note = "view the method documentation to find alternatives to this method." - )] - fn type_name(&self) -> &str { - self.get_represented_type_info() - .map(|info| info.type_path()) - .unwrap_or_else(|| self.reflect_type_path()) - } - /// Returns the [`TypeInfo`] of the type _represented_ by this value. /// /// For most types, this will simply return their own `TypeInfo`.