Add timeout argument to pump_events

This renames all internal implementations of pump_events_with_timeout
to pump_events and makes them public.

Since all platforms that support pump_events support timeouts there's
no need to have a separate API.
This commit is contained in:
Robert Bragg 2023-07-24 00:37:51 +01:00 committed by Kirill Chibisov
parent e6c7cc297d
commit ae9b02e097
9 changed files with 23 additions and 68 deletions

View file

@ -296,18 +296,7 @@ impl<T: 'static> EventLoop<T> {
}
}
pub fn pump_events<F>(&mut self, event_handler: F) -> PumpStatus
where
F: FnMut(Event<'_, T>, &RootELW<T>, &mut ControlFlow),
{
self.pump_events_with_timeout(Some(Duration::ZERO), event_handler)
}
fn pump_events_with_timeout<F>(
&mut self,
timeout: Option<Duration>,
mut event_handler: F,
) -> PumpStatus
pub fn pump_events<F>(&mut self, timeout: Option<Duration>, mut event_handler: F) -> PumpStatus
where
F: FnMut(Event<'_, T>, &RootELW<T>, &mut ControlFlow),
{