Example for bevy_ecs::event::Events uses deprecated function get_reader (#15216)

Fixes https://github.com/bevyengine/bevy/issues/15214
This commit is contained in:
Blazepaws 2024-09-15 16:24:04 +02:00 committed by GitHub
parent abac8c7b0f
commit 21e39360f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,7 @@ use std::ops::{Deref, DerefMut};
///
/// // setup
/// let mut events = Events::<MyEvent>::default();
/// let mut reader = events.get_reader();
/// let mut cursor = events.get_cursor();
///
/// // run this once per update/frame
/// events.update();
@ -54,12 +54,12 @@ use std::ops::{Deref, DerefMut};
/// events.send(MyEvent { value: 1 });
///
/// // somewhere else: read the events
/// for event in reader.read(&events) {
/// for event in cursor.read(&events) {
/// assert_eq!(event.value, 1)
/// }
///
/// // events are only processed once per reader
/// assert_eq!(reader.read(&events).count(), 0);
/// assert_eq!(cursor.read(&events).count(), 0);
/// ```
///
/// # Details