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

@ -11,7 +11,7 @@
//!
//! And the following platform-specific modules:
//!
//! - `run_ondemand` (available on `windows`, `unix`, `macos`, `android`)
//! - `run_on_demand` (available on `windows`, `unix`, `macos`, `android`)
//! - `pump_events` (available on `windows`, `unix`, `macos`, `android`)
//!
//! However only the module corresponding to the platform you're compiling to will be available.
@ -42,7 +42,7 @@ pub mod x11;
x11_platform,
wayland_platform
))]
pub mod run_ondemand;
pub mod run_on_demand;
#[cfg(any(
windows_platform,

View file

@ -28,7 +28,7 @@ pub trait EventLoopExtRunOnDemand {
/// to while maintaining the full state of your application. (If you need something like this
/// you can look at the [`EventLoopExtPumpEvents::pump_events()`] API)
///
/// Each time `run_ondemand` is called the `event_handler` can expect to receive a
/// Each time `run_on_demand` is called the `event_handler` can expect to receive a
/// `NewEvents(Init)` and `Resumed` event (even on platforms that have no suspend/resume
/// lifecycle) - which can be used to consistently initialize application state.
///
@ -59,7 +59,7 @@ pub trait EventLoopExtRunOnDemand {
///
/// [`exit()`]: EventLoopWindowTarget::exit
/// [`set_control_flow()`]: EventLoopWindowTarget::set_control_flow
fn run_ondemand<F>(&mut self, event_handler: F) -> Result<(), EventLoopError>
fn run_on_demand<F>(&mut self, event_handler: F) -> Result<(), EventLoopError>
where
F: FnMut(Event<Self::UserEvent>, &EventLoopWindowTarget<Self::UserEvent>);
}
@ -67,10 +67,10 @@ pub trait EventLoopExtRunOnDemand {
impl<T> EventLoopExtRunOnDemand for EventLoop<T> {
type UserEvent = T;
fn run_ondemand<F>(&mut self, event_handler: F) -> Result<(), EventLoopError>
fn run_on_demand<F>(&mut self, event_handler: F) -> Result<(), EventLoopError>
where
F: FnMut(Event<Self::UserEvent>, &EventLoopWindowTarget<Self::UserEvent>),
{
self.event_loop.run_ondemand(event_handler)
self.event_loop.run_on_demand(event_handler)
}
}