dont force static lifetime on appplugin string

This commit is contained in:
Carter Anderson 2020-04-04 13:00:52 -07:00
parent ef8c85f0c7
commit 4c3af427e9
11 changed files with 15 additions and 15 deletions

View file

@ -1,5 +1,5 @@
use bevy::{
app::schedule_runner::{RunMode, ScheduleRunner},
app::schedule_runner::{RunMode, ScheduleRunnerPlugin},
prelude::*,
};
use std::time::Duration;
@ -7,7 +7,7 @@ use std::time::Duration;
fn main() {
println!("This app runs once:");
App::build()
.add_plugin(ScheduleRunner {
.add_plugin(ScheduleRunnerPlugin {
run_mode: RunMode::Once,
})
.add_system(hello_world_system())
@ -15,7 +15,7 @@ fn main() {
println!("This app loops forever at 60 fps:");
App::build()
.add_plugin(ScheduleRunner {
.add_plugin(ScheduleRunnerPlugin {
run_mode: RunMode::Loop {
wait: Some(Duration::from_secs_f64(1.0 / 60.0)),
},

View file

@ -8,7 +8,7 @@ impl AppPlugin for ExamplePlugin {
app_builder.setup(setup)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"example"
}
}

View file

@ -4,7 +4,7 @@ use std::any::Any;
pub trait AppPlugin: Any + Send + Sync {
fn build(&self, app: AppBuilder) -> AppBuilder;
fn name(&self) -> &'static str;
fn name(&self) -> &str;
}
pub type CreateAppPlugin = unsafe fn() -> *mut dyn AppPlugin;

View file

@ -17,11 +17,11 @@ impl Default for RunMode {
}
#[derive(Default)]
pub struct ScheduleRunner {
pub struct ScheduleRunnerPlugin {
pub run_mode: RunMode,
}
impl AppPlugin for ScheduleRunner {
impl AppPlugin for ScheduleRunnerPlugin {
fn build(&self, app: AppBuilder) -> AppBuilder {
let run_mode = self.run_mode;
app.set_runner(move |mut app: App| match run_mode {
@ -36,7 +36,7 @@ impl AppPlugin for ScheduleRunner {
},
})
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"ScheduleRun"
}
}

View file

@ -14,7 +14,7 @@ impl AppPlugin for CorePlugin {
app.add_resource(Time::new())
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"Core"
}
}

View file

@ -36,7 +36,7 @@ impl AppPlugin for DiagnosticsPlugin {
app
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"Diagnostics"
}
}

View file

@ -70,7 +70,7 @@ impl AppPlugin for RenderPlugin {
app
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"Render"
}
}

View file

@ -24,7 +24,7 @@ impl AppPlugin for WgpuRendererPlugin {
let render_system = wgpu_render_system(&app.resources);
app.add_thread_local_to_stage(system_stage::RENDER, render_system)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"WgpuRenderer"
}
}

View file

@ -17,7 +17,7 @@ impl AppPlugin for UiPlugin {
fn build(&self, app: AppBuilder) -> AppBuilder {
app.add_system(ui_update_system())
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"UI"
}
}

View file

@ -34,7 +34,7 @@ impl AppPlugin for WindowPlugin {
app
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"Window"
}
}

View file

@ -19,7 +19,7 @@ impl AppPlugin for WinitPlugin {
.set_runner(winit_runner)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"Winit"
}
}