Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hymm committed Nov 22, 2023
1 parent f6714b6 commit 40dbea3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 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
4 changes: 2 additions & 2 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
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 40dbea3

Please sign in to comment.