pub unsafe trait NativeSurface:
Send
+ Sync
+ 'static {
// Required methods
fn window_handle(&self) -> Result<RawWindowHandle, HandleError>;
fn display_handle(&self) -> Result<RawDisplayHandle, HandleError>;
}Expand description
A backend’s native surface: what raw-window-handle describes for a
GPU API to present to (an NSView backed by a CAMetalLayer, a
Wayland surface, a child window).
It lives as long as any SurfaceHandle to it, even after its widget
is gone, so a GPU surface made on it never outlives it. It may be
dropped on any thread: a backend whose native objects must be freed on
the UI thread sends them there.
§Safety
The handles it returns stay valid for as long as it lives:
SurfaceHandle lends them to GPU APIs on that promise.
Required Methods§
fn window_handle(&self) -> Result<RawWindowHandle, HandleError>
fn display_handle(&self) -> Result<RawDisplayHandle, HandleError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".