IntoIterator for EventReader (#7720)
# Objective Continuation of https://github.com/bevyengine/bevy/pull/5719 Now that we have a definable type for the iterator. --- ## Changelog - Implemented IntoIterator for EventReader so you can now do `&mut reader` instead of `reader.iter()` for events.
This commit is contained in:
		
							parent
							
								
									18cfb226db
								
							
						
					
					
						commit
						b24ed8bb0c
					
				| @ -241,6 +241,14 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl<'a, 'w, 's, E: Event> IntoIterator for &'a mut EventReader<'w, 's, E> { | ||||
|     type Item = &'a E; | ||||
|     type IntoIter = ManualEventIterator<'a, E>; | ||||
|     fn into_iter(self) -> Self::IntoIter { | ||||
|         self.iter() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /// Sends events of type `T`.
 | ||||
| ///
 | ||||
| /// # Usage
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Aceeri
						Aceeri