Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hymm committed Nov 23, 2023
1 parent f6714b6 commit c79c24c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
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
8 changes: 4 additions & 4 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 @@ -458,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
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
2 changes: 1 addition & 1 deletion 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
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
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ fn assert_component_access_compatibility(
/// &World,
/// )>,
/// ) {
/// for event in set.p0().iter() {
/// for event in set.p0().read() {
/// // ...
/// # let _event = event;
/// }
Expand Down

0 comments on commit c79c24c

Please sign in to comment.