Trait HasWindowHandle
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§
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
Get a handle to the window.
Implementations on Foreign Types§
§impl HasWindowHandle for NoWindowHandle
impl HasWindowHandle for NoWindowHandle
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl HasWindowHandle for Window
Available on crate feature rwh_06
only.
impl HasWindowHandle for Window
rwh_06
only.fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl<D, W> HasWindowHandle for Surface<D, W>where
D: HasDisplayHandle,
W: HasWindowHandle,
impl<D, W> HasWindowHandle for Surface<D, W>where
D: HasDisplayHandle,
W: HasWindowHandle,
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl<H> HasWindowHandle for &Hwhere
H: HasWindowHandle + ?Sized,
impl<H> HasWindowHandle for &Hwhere
H: HasWindowHandle + ?Sized,
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl<H> HasWindowHandle for &mut Hwhere
H: HasWindowHandle + ?Sized,
impl<H> HasWindowHandle for &mut Hwhere
H: HasWindowHandle + ?Sized,
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl<H> HasWindowHandle for Box<H>where
H: HasWindowHandle + ?Sized,
Available on crate feature alloc
only.
impl<H> HasWindowHandle for Box<H>where
H: HasWindowHandle + ?Sized,
alloc
only.fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl<H> HasWindowHandle for Rc<H>where
H: HasWindowHandle + ?Sized,
Available on crate feature alloc
only.
impl<H> HasWindowHandle for Rc<H>where
H: HasWindowHandle + ?Sized,
alloc
only.fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
§impl<H> HasWindowHandle for Arc<H>where
H: HasWindowHandle + ?Sized,
Available on crate feature alloc
only.
impl<H> HasWindowHandle for Arc<H>where
H: HasWindowHandle + ?Sized,
alloc
only.