@@ -378,6 +378,12 @@ where {
378
378
/// Blocks the current thread until next event is ready and returns it.
379
379
///
380
380
/// Typically you would spawn a thread or task that calls this in a loop.
381
+ ///
382
+ /// **Note**: Users must handle events as soon as possible to avoid an increased event queue
383
+ /// memory footprint. We will start dropping any generated events after
384
+ /// [`MAX_EVENT_QUEUE_SIZE`] has been reached.
385
+ ///
386
+ /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE
381
387
#[ cfg( feature = "std" ) ]
382
388
pub fn wait_next_event ( & self ) -> Event {
383
389
self . pending_events . wait_next_event ( )
@@ -386,20 +392,38 @@ where {
386
392
/// Returns `Some` if an event is ready.
387
393
///
388
394
/// Typically you would spawn a thread or task that calls this in a loop.
395
+ ///
396
+ /// **Note**: Users must handle events as soon as possible to avoid an increased event queue
397
+ /// memory footprint. We will start dropping any generated events after
398
+ /// [`MAX_EVENT_QUEUE_SIZE`] has been reached.
399
+ ///
400
+ /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE
389
401
pub fn next_event ( & self ) -> Option < Event > {
390
402
self . pending_events . next_event ( )
391
403
}
392
404
393
405
/// Asynchronously polls the event queue and returns once the next event is ready.
394
406
///
395
407
/// Typically you would spawn a thread or task that calls this in a loop.
408
+ ///
409
+ /// **Note**: Users must handle events as soon as possible to avoid an increased event queue
410
+ /// memory footprint. We will start dropping any generated events after
411
+ /// [`MAX_EVENT_QUEUE_SIZE`] has been reached.
412
+ ///
413
+ /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE
396
414
pub async fn next_event_async ( & self ) -> Event {
397
415
self . pending_events . next_event_async ( ) . await
398
416
}
399
417
400
418
/// Returns and clears all events without blocking.
401
419
///
402
420
/// Typically you would spawn a thread or task that calls this in a loop.
421
+ ///
422
+ /// **Note**: Users must handle events as soon as possible to avoid an increased event queue
423
+ /// memory footprint. We will start dropping any generated events after
424
+ /// [`MAX_EVENT_QUEUE_SIZE`] has been reached.
425
+ ///
426
+ /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE
403
427
pub fn get_and_clear_pending_events ( & self ) -> Vec < Event > {
404
428
self . pending_events . get_and_clear_pending_events ( )
405
429
}
0 commit comments