pub trait Renderer {
type Error: Error;
type TextureId: Texture;
type Frame: Frame<Error = Self::Error, TextureId = Self::TextureId>;
// Required method
fn render<F, R>(
&mut self,
size: Size<i32, Physical>,
transform: Transform,
rendering: F,
) -> Result<R, Self::Error>
where F: FnOnce(&mut Self, &mut Self::Frame) -> R;
}
Expand description
Abstraction of commonly used rendering operations for compositors.
Required Associated Types§
Required Methods§
Sourcefn render<F, R>(
&mut self,
size: Size<i32, Physical>,
transform: Transform,
rendering: F,
) -> Result<R, Self::Error>
fn render<F, R>( &mut self, size: Size<i32, Physical>, transform: Transform, rendering: F, ) -> Result<R, Self::Error>
Initialize a rendering context on the current rendering target with given dimensions and transformation.
This function may error, if:
- The given dimensions are unsupported (too large) for this renderer
- The given Transformation is not supported by the renderer (
Transform::Normal
is always supported). - This renderer implements
Bind
, no target was bound and has no default target. - (Renderers not implementing
Bind
always have a default target.)
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.