pub trait AccessWinitWindow {
// Required methods
fn map_winit_window<F, T>(&self, f: F) -> T
where F: FnOnce(&Box<dyn WinitWindow>) -> T;
fn map_winit_window_mut<F, T>(&mut self, f: F) -> T
where F: FnOnce(&mut Box<dyn WinitWindow>) -> T;
}Expand description
Trait to access to its internally owned
winit::window::Window object.
This trait is made so that the user of this package
can write
trait AccessWinitWindowExt : AccessWinitWindow
plus
impl<T> AccessWinitWindowExt for T where T: AccessWinitWindow {}
to extend the behaviour of our Window object.
Please notice not only the holder of Window but
also the aeth-window subsystem will need to
access the underlying winit::window::Window
object. The holder is always an async task, and
allowing it to hold a std::cell::Ref to the
winit::window::Window can cause the window
subsystem to fail when they also borrow an
instance of it. So we enforce short-lived
reference access here by forcing the operation
on winit::window::Window to be completed
within a function.
Required Methods§
Sourcefn map_winit_window<F, T>(&self, f: F) -> T
fn map_winit_window<F, T>(&self, f: F) -> T
Manipulate the underlying winit::window::Window
in an immutable manner.
Sourcefn map_winit_window_mut<F, T>(&mut self, f: F) -> T
fn map_winit_window_mut<F, T>(&mut self, f: F) -> T
Manipulate the underlying winit::window::Window
in a mutable manner.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".