Skip to main content

Surface

Trait Surface 

Source
pub trait Surface<D: Device>: Sized {
    type Frame: SurfaceFrame<D>;

    // Required methods
    fn configure(&mut self, device: &D, config: &SurfaceConfig);
    fn config(&self) -> &SurfaceConfig;
    fn acquire(&mut self) -> Result<Self::Frame, SurfaceError>;
}
Expand description

A presentation surface bound to a window.

Required Associated Types§

Source

type Frame: SurfaceFrame<D>

The acquired-frame type.

Required Methods§

Source

fn configure(&mut self, device: &D, config: &SurfaceConfig)

(Re)configures for the given size; called on open and on resize.

Source

fn config(&self) -> &SurfaceConfig

The current configuration.

Source

fn acquire(&mut self) -> Result<Self::Frame, SurfaceError>

Acquires the next frame.

§Errors

Lost, outdated, timed out, or out of memory — all recoverable by reconfiguring and skipping the frame.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§