Skip to main content

RendererFactory

Trait RendererFactory 

Source
pub trait RendererFactory: 'static {
    // Required method
    fn create(
        &self,
        target: RendererTarget<'_>,
    ) -> Result<Box<dyn PlatformRenderer>, Error>;
}
Expand description

Builds a window’s renderer from the surface the window has already made.

It runs exactly once per window, after the native window exists and before the first frame, because a renderer binds to a surface and the surface comes from the window. On the recovery path the renderer is handed a RendererTarget built from the surface it already has, not a new one from here.

Required Methods§

Source

fn create( &self, target: RendererTarget<'_>, ) -> Result<Box<dyn PlatformRenderer>, Error>

Build the renderer this window will draw through.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§