Skip to content

Commit

Permalink
delete methods deprecated in 0.12 (#10693)
Browse files Browse the repository at this point in the history
## Changelog

- delete methods deprecated in 0.12
  • Loading branch information
hymm authored Nov 24, 2023
1 parent 6f56380 commit 11b1b3a
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 340 deletions.
11 changes: 0 additions & 11 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 0 additions & 4 deletions crates/bevy_asset/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,6 @@ impl Typed for AssetPath<'static> {
}
}
impl Reflect for AssetPath<'static> {
#[inline]
fn type_name(&self) -> &str {
::core::any::type_name::<Self>()
}
#[inline]
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ fn writer(mut writer: EventWriter<MyEvent>) {
}

fn reader(mut reader: EventReader<MyEvent>) {
for event in reader.iter() {
for event in reader.read() {
}
}
```
Expand Down
48 changes: 4 additions & 44 deletions crates/bevy_ecs/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ struct EventInstance<E: Event> {
/// events.send(MyEvent { value: 1 });
///
/// // somewhere else: read the events
/// for event in reader.iter(&events) {
/// for event in reader.read(&events) {
/// assert_eq!(event.value, 1)
/// }
///
/// // events are only processed once per reader
/// assert_eq!(reader.iter(&events).count(), 0);
/// assert_eq!(reader.read(&events).count(), 0);
/// ```
///
/// # Details
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -472,8 +458,8 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> {

/// Consumes all available events.
///
/// This means these events will not appear in calls to [`EventReader::iter()`] or
/// [`EventReader::iter_with_id()`] and [`EventReader::is_empty()`] will return `true`.
/// This means these events will not appear in calls to [`EventReader::read()`] or
/// [`EventReader::read_with_id()`] and [`EventReader::is_empty()`] will return `true`.
///
/// For usage, see [`EventReader::is_empty()`].
pub fn clear(&mut self) {
Expand Down Expand Up @@ -583,23 +569,11 @@ impl<E: Event> ManualEventReader<E> {
self.read_with_id(events).without_id()
}

/// See [`EventReader::iter`]
#[deprecated = "use `.read()` instead."]
pub fn iter<'a>(&'a mut self, events: &'a Events<E>) -> 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<E>) -> 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<E>) -> EventIteratorWithId<'a, E> {
EventIteratorWithId::new(self, events)
}

/// See [`EventReader::len`]
pub fn len(&self, events: &Events<E>) -> usize {
// The number of events in this reader is the difference between the most recent event
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down Expand Up @@ -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<E>, events: &'a Events<E>) -> Self {
Expand Down
4 changes: 0 additions & 4 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ pub mod prelude {
#[doc(hidden)]
#[cfg(feature = "bevy_reflect")]
pub use crate::reflect::{AppTypeRegistry, ReflectComponent, ReflectResource};
#[allow(deprecated)]
pub use crate::system::adapter::{
self as system_adapter, dbg, error, ignore, info, unwrap, warn,
};
#[doc(hidden)]
pub use crate::{
bundle::Bundle,
Expand Down
13 changes: 0 additions & 13 deletions crates/bevy_ecs/src/query/par_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FN: Fn(QueryItem<'w, Q>) + 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() {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/reflect/entity_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub trait ReflectCommandExt {
/// // ComponentA or ComponentB. No matter which component is in the resource though,
/// // we can attempt to remove any component of that same type from an entity.
/// commands.entity(prefab.entity)
/// .remove_reflect(prefab.component.type_name().to_owned());
/// .remove_reflect(prefab.component.reflect_type_path().to_owned());
/// }
///
/// ```
Expand Down
16 changes: 1 addition & 15 deletions crates/bevy_ecs/src/removal_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl RemovedComponentEvents {
/// # #[derive(Component)]
/// # struct MyComponent;
/// fn react_on_removal(mut removed: RemovedComponents<MyComponent>) {
/// removed.iter().for_each(|removed_entity| println!("{:?}", removed_entity));
/// removed.read().for_each(|removed_entity| println!("{:?}", removed_entity));
/// }
/// # bevy_ecs::system::assert_is_system(react_on_removal);
/// ```
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down
7 changes: 0 additions & 7 deletions crates/bevy_ecs/src/schedule/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
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 @@ -156,7 +156,7 @@ impl SystemMeta {
/// world.resource_scope(|world, mut cached_state: Mut<CachedSystemState>| {
/// let mut event_reader = cached_state.event_state.get_mut(world);
///
/// for events in event_reader.iter() {
/// for events in event_reader.read() {
/// println!("Hello World!");
/// }
/// });
Expand Down
Loading

0 comments on commit 11b1b3a

Please sign in to comment.