dont force static lifetime on appplugin string
This commit is contained in:
		
							parent
							
								
									ef8c85f0c7
								
							
						
					
					
						commit
						4c3af427e9
					
				| @ -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)), | ||||
|             }, | ||||
|  | ||||
| @ -8,7 +8,7 @@ impl AppPlugin for ExamplePlugin { | ||||
|         app_builder.setup(setup) | ||||
|     } | ||||
| 
 | ||||
|     fn name(&self) -> &'static str { | ||||
|     fn name(&self) -> &str { | ||||
|         "example" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -14,7 +14,7 @@ impl AppPlugin for CorePlugin { | ||||
|         app.add_resource(Time::new()) | ||||
|     } | ||||
| 
 | ||||
|     fn name(&self) -> &'static str { | ||||
|     fn name(&self) -> &str { | ||||
|         "Core" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -36,7 +36,7 @@ impl AppPlugin for DiagnosticsPlugin { | ||||
| 
 | ||||
|         app | ||||
|     } | ||||
|     fn name(&self) -> &'static str { | ||||
|     fn name(&self) -> &str { | ||||
|         "Diagnostics" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -70,7 +70,7 @@ impl AppPlugin for RenderPlugin { | ||||
|         app | ||||
|     } | ||||
| 
 | ||||
|     fn name(&self) -> &'static str { | ||||
|     fn name(&self) -> &str { | ||||
|         "Render" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -34,7 +34,7 @@ impl AppPlugin for WindowPlugin { | ||||
|         app | ||||
|     } | ||||
| 
 | ||||
|     fn name(&self) -> &'static str { | ||||
|     fn name(&self) -> &str { | ||||
|         "Window" | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -19,7 +19,7 @@ impl AppPlugin for WinitPlugin { | ||||
|             .set_runner(winit_runner) | ||||
|     } | ||||
| 
 | ||||
|     fn name(&self) -> &'static str { | ||||
|     fn name(&self) -> &str { | ||||
|         "Winit" | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Carter Anderson
						Carter Anderson