Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSentry committed May 7, 2022
1 parent e4f27b6 commit 8a5b576
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/bevy_ecs/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,14 @@ impl<'w, 's, T: Resource> EventReader<'w, 's, T> {
}

/// Determines if there are any events available to be read without consuming any.
/// If you need to consume the iterator you can use [`EventReader::any`]
pub fn is_empty(&self) -> bool {
self.len() == 0
}

/// Determines if there are any events available to be read and consumes all events.
/// If you don't need to consume the iterator you can use [`EventReader::is_empty`]
/// WARNING: `events.any()` is not the same as doing `!events.is_empty()`
pub fn any(&mut self) -> bool {
self.iter().last().is_some()
}
Expand Down

0 comments on commit 8a5b576

Please sign in to comment.