Skip to main content

WindowProvider

Trait WindowProvider 

Source
pub trait WindowProvider: 'static {
    type Handle: GPUSurfaceHandle;
    type Exposed: Clone + Send + Sync + 'static;

    // Required methods
    fn create(config: &WindowConfig) -> Self;
    fn size(handle: &Self::Handle) -> (u32, u32);
    fn exposed(&self) -> Self::Exposed;
    fn handle(&self) -> &Self::Handle;
}
Expand description

Abstracts over a platform-specific window implementation.

Implement this trait to plug in any windowing library (e.g. winit). The associated types expose the window handle used for surface creation and an “exposed” value (e.g. a shareable Arc) that systems can inspect.

Required Associated Types§

Source

type Handle: GPUSurfaceHandle

The concrete window handle type used to create a GPU surface.

Source

type Exposed: Clone + Send + Sync + 'static

An additional value derived from the window that can be cloned and shared with other parts of the app (e.g. an Arc<Window>).

Required Methods§

Source

fn create(config: &WindowConfig) -> Self

Create a window using the provided configuration.

Source

fn size(handle: &Self::Handle) -> (u32, u32)

Return the current inner size of handle in physical pixels.

Source

fn exposed(&self) -> Self::Exposed

Return the exposed value for this window.

Source

fn handle(&self) -> &Self::Handle

Return a reference to the raw window handle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§