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