Skip to content

Commit

Permalink
Merge pull request #405 from G8XSU/events-hurry-up
Browse files Browse the repository at this point in the history
Add note to handle events as quickly as possible.
  • Loading branch information
tnull authored Nov 20, 2024
2 parents aaccde7 + 62b0a2a commit 34fd852
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,9 @@ impl Node {
/// Will return `Some(..)` if an event is available and `None` otherwise.
///
/// **Note:** this will always return the same event until handling is confirmed via [`Node::event_handled`].
///
/// **Caution:** Users must handle events as quickly as possible to prevent a large event backlog,
/// which can increase the memory footprint of [`Node`].
pub fn next_event(&self) -> Option<Event> {
self.event_queue.next_event()
}
Expand All @@ -763,6 +766,9 @@ impl Node {
/// Will asynchronously poll the event queue until the next event is ready.
///
/// **Note:** this will always return the same event until handling is confirmed via [`Node::event_handled`].
///
/// **Caution:** Users must handle events as quickly as possible to prevent a large event backlog,
/// which can increase the memory footprint of [`Node`].
pub async fn next_event_async(&self) -> Event {
self.event_queue.next_event_async().await
}
Expand All @@ -772,6 +778,9 @@ impl Node {
/// Will block the current thread until the next event is available.
///
/// **Note:** this will always return the same event until handling is confirmed via [`Node::event_handled`].
///
/// **Caution:** Users must handle events as quickly as possible to prevent a large event backlog,
/// which can increase the memory footprint of [`Node`].
pub fn wait_next_event(&self) -> Event {
self.event_queue.wait_next_event()
}
Expand Down

0 comments on commit 34fd852

Please sign in to comment.