Rename run_ondemand to run_on_demand

This commit is contained in:
epimeletes 2023-10-03 23:24:42 +02:00 committed by GitHub
parent c7cf0cfd83
commit ee0db52ac4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 25 additions and 24 deletions

View file

@ -488,10 +488,10 @@ impl<T: 'static> EventLoop<T> {
where
F: FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget<T>),
{
self.run_ondemand(event_handler)
self.run_on_demand(event_handler)
}
pub fn run_ondemand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
pub fn run_on_demand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
where
F: FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget<T>),
{

View file

@ -774,14 +774,14 @@ impl<T: 'static> EventLoop<T> {
where
F: FnMut(crate::event::Event<T>, &RootELW<T>),
{
self.run_ondemand(callback)
self.run_on_demand(callback)
}
pub fn run_ondemand<F>(&mut self, callback: F) -> Result<(), EventLoopError>
pub fn run_on_demand<F>(&mut self, callback: F) -> Result<(), EventLoopError>
where
F: FnMut(crate::event::Event<T>, &RootELW<T>),
{
x11_or_wayland!(match self; EventLoop(evlp) => evlp.run_ondemand(callback))
x11_or_wayland!(match self; EventLoop(evlp) => evlp.run_on_demand(callback))
}
pub fn pump_events<F>(&mut self, timeout: Option<Duration>, callback: F) -> PumpStatus

View file

@ -40,7 +40,7 @@ type WaylandDispatcher = calloop::Dispatcher<'static, WaylandSource<WinitState>,
/// The Wayland event loop.
pub struct EventLoop<T: 'static> {
/// Has `run` or `run_ondemand` been called or a call to `pump_events` that starts the loop
/// Has `run` or `run_on_demand` been called or a call to `pump_events` that starts the loop
loop_running: bool,
buffer_sink: EventSink,
@ -189,7 +189,7 @@ impl<T: 'static> EventLoop<T> {
Ok(event_loop)
}
pub fn run_ondemand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
pub fn run_on_demand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
where
F: FnMut(Event<T>, &RootEventLoopWindowTarget<T>),
{
@ -212,7 +212,7 @@ impl<T: 'static> EventLoop<T> {
};
// Applications aren't allowed to carry windows between separate
// `run_ondemand` calls but if they have only just dropped their
// `run_on_demand` calls but if they have only just dropped their
// windows we need to make sure those last requests are sent to the
// compositor.
let _ = self.roundtrip().map_err(EventLoopError::Os);

View file

@ -398,7 +398,7 @@ impl<T: 'static> EventLoop<T> {
&self.target
}
pub fn run_ondemand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
pub fn run_on_demand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
where
F: FnMut(Event<T>, &RootELW<T>),
{
@ -421,7 +421,7 @@ impl<T: 'static> EventLoop<T> {
};
// Applications aren't allowed to carry windows between separate
// `run_ondemand` calls but if they have only just dropped their
// `run_on_demand` calls but if they have only just dropped their
// windows we need to make sure those last requests are sent to the
// X Server.
let wt = get_xtarget(&self.target);

View file

@ -359,7 +359,7 @@ impl AppState {
/// and can lead to undefined behaviour if the callback is not cleared before the end of
/// its real lifetime.
///
/// All public APIs that take an event callback (`run`, `run_ondemand`,
/// All public APIs that take an event callback (`run`, `run_on_demand`,
/// `pump_events`) _must_ pair a call to `set_callback` with
/// a call to `clear_callback` before returning to avoid undefined behaviour.
pub unsafe fn set_callback<T>(

View file

@ -231,14 +231,14 @@ impl<T> EventLoop<T> {
where
F: FnMut(Event<T>, &RootWindowTarget<T>),
{
self.run_ondemand(callback)
self.run_on_demand(callback)
}
// NB: we don't base this on `pump_events` because for `MacOs` we can't support
// `pump_events` elegantly (we just ask to run the loop for a "short" amount of
// time and so a layered implementation would end up using a lot of CPU due to
// redundant wake ups.
pub fn run_ondemand<F>(&mut self, callback: F) -> Result<(), EventLoopError>
pub fn run_on_demand<F>(&mut self, callback: F) -> Result<(), EventLoopError>
where
F: FnMut(Event<T>, &RootWindowTarget<T>),
{

View file

@ -252,10 +252,10 @@ impl<T: 'static> EventLoop<T> {
where
F: FnMut(Event<T>, &RootELW<T>),
{
self.run_ondemand(event_handler)
self.run_on_demand(event_handler)
}
pub fn run_ondemand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
pub fn run_on_demand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
where
F: FnMut(Event<T>, &RootELW<T>),
{

View file

@ -88,7 +88,7 @@ impl<T> EventLoopRunner<T> {
/// outlive the EventLoopRunner) and can lead to undefined behaviour if
/// the handler is not cleared before the end of real lifetime.
///
/// All public APIs that take an event handler (`run`, `run_ondemand`,
/// All public APIs that take an event handler (`run`, `run_on_demand`,
/// `pump_events`) _must_ pair a call to `set_event_handler` with
/// a call to `clear_event_handler` before returning to avoid
/// undefined behaviour.