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§

source

fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>

Get a handle to the window.

Implementations on Foreign Types§

source§

impl HasWindowHandle for NoWindowHandle

source§

impl<D, W> HasWindowHandle for Surface<D, W>

source§

impl<H> HasWindowHandle for &H
where H: HasWindowHandle + ?Sized,

source§

impl<H> HasWindowHandle for &mut H
where H: HasWindowHandle + ?Sized,

source§

impl<H> HasWindowHandle for Box<H>
where H: HasWindowHandle + ?Sized,

source§

impl<H> HasWindowHandle for Rc<H>
where H: HasWindowHandle + ?Sized,

source§

impl<H> HasWindowHandle for Arc<H>
where H: HasWindowHandle + ?Sized,

Implementors§