parasyte/pixels

Access `Window` from `Pixels`?

開放

#421 建立於 2025年4月14日

 (7 則留言) (0 個反應) (0 位負責人)Rust (147 個分叉)auto 404
enhancementhelp wantedquestionrfc

倉庫指標

星標
 (2,121 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

With the new 0.30 winit ApplicationHandler API using a Pixels<'a> for any lifetime other than 'static just got significantly harder, because all app state must now exist within one struct, which must exist before opening the window. The current workaround is to store an Arc<Window> and create the Pixels<'static> from it; but it would be far easier if the Pixels could own the window and simply have an accessor through which application code can use its own Window. Otherwise a self-referencing struct would be required with the Pixels referencing the Window stored alongside it in the same struct.

Anyways I'm proposing Pixels::window(&self) + Pixels::window_mut(&mut self) that return a reference to the winit::window::Window the Pixels was created with

貢獻者指南