diff --git a/src/application.rs b/src/application.rs index d3135ec..8882637 100644 --- a/src/application.rs +++ b/src/application.rs @@ -30,10 +30,10 @@ impl Display for OverlayMode { } } -pub struct Application<'a> { +pub struct Application { _instance: wgpu::Instance, surface_config: wgpu::SurfaceConfiguration, - surface: wgpu::Surface<'a>, + surface: wgpu::Surface<'static>, _adapter: wgpu::Adapter, device: wgpu::Device, queue: wgpu::Queue, @@ -56,7 +56,7 @@ pub struct Application<'a> { field_function: String, } -impl<'a> Application<'a> { +impl Application { pub async fn new(window: Arc) -> Result { let size = window.inner_size(); let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { diff --git a/src/main.rs b/src/main.rs index 8612bce..b39b898 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,20 +35,20 @@ fn start_watcher(tx: Sender>) -> Result { - ApplicationCreated(Application<'a>), +enum UserEvent { + ApplicationCreated(Application), } -struct ApplicationWindow<'a> { - app: Option>, +struct ApplicationWindow { + app: Option, window: Option>, close_requested: bool, - event_proxy: EventLoopProxy>, + event_proxy: EventLoopProxy, #[cfg(not(target_arch = "wasm32"))] shader_rx: Receiver>, } -impl<'a> ApplicationHandler> for ApplicationWindow<'a> { +impl ApplicationHandler for ApplicationWindow { fn resumed(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) { if self.app.is_some() { return; @@ -114,11 +114,7 @@ impl<'a> ApplicationHandler> for ApplicationWindow<'a> { wasm_bindgen_futures::spawn_local(app_closure); } - fn user_event( - &mut self, - _event_loop: &winit::event_loop::ActiveEventLoop, - event: UserEvent<'a>, - ) { + fn user_event(&mut self, _event_loop: &winit::event_loop::ActiveEventLoop, event: UserEvent) { match event { UserEvent::ApplicationCreated(application) => { self.app = Some(application);