Trait raw_window_handle::HasWindowHandle
source · pub trait HasWindowHandle {
// Required method
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>;
}
Expand description
A handle to a window.
Objects that implement this trait should be able to return a WindowHandle
for the window
that they are associated with. This handle should last for the lifetime of the object, and should
return an error if the application is inactive.
Implementors of this trait will be windowing systems, like winit
and sdl2
. These windowing
systems should implement this trait on types that represent windows.
Users of this trait will include graphics libraries, like wgpu
and glutin
. These APIs
should be generic over a type that implements HasWindowHandle
, and should use the
WindowHandle
type to access the window handle. The window handle should be acquired and held
while the window is being used, in order to ensure that the window is not deleted while it is in
use.
Required Methods§
sourcefn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
Get a handle to the window.