render: move Error type into associated types

This commit is contained in:
Victoria Fischer 2024-12-01 21:28:34 +01:00
parent 5c10dcbd7d
commit 132d7c0a33
2 changed files with 4 additions and 2 deletions

View File

@ -163,7 +163,8 @@ impl<S: Surface + Default> SurfacePool<S> {
impl<S: Surface + Default> Surfaces for SurfacePool<S> {
type Surface = S;
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<S, io::Error> {
type Error = io::Error;
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<S, Self::Error> {
let mut surface = S::default();
surface.set_rect(area);
self.surfaces.push(surface.clone());

View File

@ -29,7 +29,8 @@ pub trait Shader: Send + Sync {
pub trait Surfaces: Send + Sync {
type Surface: Surface;
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<Self::Surface, io::Error>;
type Error: Debug;
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<Self::Surface, Self::Error>;
fn render_to<S: Sample>(&self, output: &mut S, frame: usize);
}