pub trait Compositor: Sized {
    type Renderer;
    type Surface;
    // Required methods
    fn with_backend<W>(
        _settings: Settings,
        _compatible_window: W,
        _backend: Option<&str>,
    ) -> impl Future<Output = Result<Self, Error>>
       where W: Window + Clone;
    fn create_renderer(&self) -> Self::Renderer;
    fn create_surface<W>(
        &mut self,
        window: W,
        width: u32,
        height: u32,
    ) -> Self::Surface
       where W: Window + Clone;
    fn configure_surface(
        &mut self,
        surface: &mut Self::Surface,
        width: u32,
        height: u32,
    );
    fn fetch_information(&self) -> Information;
    fn present<T>(
        &mut self,
        renderer: &mut Self::Renderer,
        surface: &mut Self::Surface,
        viewport: &Viewport,
        background_color: Color,
        overlay: &[T],
    ) -> Result<(), SurfaceError>
       where T: AsRef<str>;
    fn screenshot<T>(
        &mut self,
        renderer: &mut Self::Renderer,
        viewport: &Viewport,
        background_color: Color,
        overlay: &[T],
    ) -> Vec<u8> ⓘ
       where T: AsRef<str>;
    // Provided methods
    fn new<W>(
        settings: Settings,
        compatible_window: W,
    ) -> impl Future<Output = Result<Self, Error>>
       where W: Window + Clone { ... }
    fn load_font(&mut self, font: Cow<'static, [u8]>) { ... }
}Expand description
A graphics compositor that can draw to windows.
Required Associated Types§
Required Methods§
Sourcefn with_backend<W>(
    _settings: Settings,
    _compatible_window: W,
    _backend: Option<&str>,
) -> impl Future<Output = Result<Self, Error>>
 
fn with_backend<W>( _settings: Settings, _compatible_window: W, _backend: Option<&str>, ) -> impl Future<Output = Result<Self, Error>>
Creates a new Compositor with a backend preference.
If the backend does not match the preference, it will return
Error::GraphicsAdapterNotFound.
Sourcefn create_renderer(&self) -> Self::Renderer
 
fn create_renderer(&self) -> Self::Renderer
Creates a Self::Renderer for the Compositor.
Sourcefn create_surface<W>(
    &mut self,
    window: W,
    width: u32,
    height: u32,
) -> Self::Surface
 
fn create_surface<W>( &mut self, window: W, width: u32, height: u32, ) -> Self::Surface
Crates a new Surface for the given window.
Sourcefn configure_surface(
    &mut self,
    surface: &mut Self::Surface,
    width: u32,
    height: u32,
)
 
fn configure_surface( &mut self, surface: &mut Self::Surface, width: u32, height: u32, )
Configures a new Surface with the given dimensions.
Sourcefn fetch_information(&self) -> Information
 
fn fetch_information(&self) -> Information
Returns Information used by this Compositor.
Sourcefn present<T>(
    &mut self,
    renderer: &mut Self::Renderer,
    surface: &mut Self::Surface,
    viewport: &Viewport,
    background_color: Color,
    overlay: &[T],
) -> Result<(), SurfaceError>
 
fn present<T>( &mut self, renderer: &mut Self::Renderer, surface: &mut Self::Surface, viewport: &Viewport, background_color: Color, overlay: &[T], ) -> Result<(), SurfaceError>
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.