mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 22:20:20 +00:00
Relaxed runner type from Fn
to FnOnce
(#8961)
# Objective Relax unnecessary type restrictions on `App.runner` function. ## Solution Changed the type of `App.runner` from `Fn(App)` to `FnOnce(App)`.
This commit is contained in:
parent
f4fdbef60b
commit
418d3273fd
1 changed files with 2 additions and 2 deletions
|
@ -64,7 +64,7 @@ pub struct App {
|
|||
/// the application's event loop and advancing the [`Schedule`].
|
||||
/// Typically, it is not configured manually, but set by one of Bevy's built-in plugins.
|
||||
/// See `bevy::winit::WinitPlugin` and [`ScheduleRunnerPlugin`](crate::schedule_runner::ScheduleRunnerPlugin).
|
||||
pub runner: Box<dyn Fn(App) + Send>, // Send bound is required to make App Send
|
||||
pub runner: Box<dyn FnOnce(App) + Send>, // Send bound is required to make App Send
|
||||
/// The schedule that systems are added to by default.
|
||||
///
|
||||
/// The schedule that runs the main loop of schedule execution.
|
||||
|
@ -651,7 +651,7 @@ impl App {
|
|||
/// App::new()
|
||||
/// .set_runner(my_runner);
|
||||
/// ```
|
||||
pub fn set_runner(&mut self, run_fn: impl Fn(App) + 'static + Send) -> &mut Self {
|
||||
pub fn set_runner(&mut self, run_fn: impl FnOnce(App) + 'static + Send) -> &mut Self {
|
||||
self.runner = Box::new(run_fn);
|
||||
self
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue