From 132d7c0a333be6608e22e72acabbcc237d560156 Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Sun, 1 Dec 2024 21:28:34 +0100 Subject: [PATCH] render: move Error type into associated types --- src/buffers.rs | 3 ++- src/render.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/buffers.rs b/src/buffers.rs index cab4f9a..e259597 100644 --- a/src/buffers.rs +++ b/src/buffers.rs @@ -163,7 +163,8 @@ impl SurfacePool { impl Surfaces for SurfacePool { type Surface = S; - fn new_surface(&mut self, area: &Rectangle) -> Result { + type Error = io::Error; + fn new_surface(&mut self, area: &Rectangle) -> Result { let mut surface = S::default(); surface.set_rect(area); self.surfaces.push(surface.clone()); diff --git a/src/render.rs b/src/render.rs index 9d9b0d3..a77cad0 100644 --- a/src/render.rs +++ b/src/render.rs @@ -29,7 +29,8 @@ pub trait Shader: Send + Sync { pub trait Surfaces: Send + Sync { type Surface: Surface; - fn new_surface(&mut self, area: &Rectangle) -> Result; + type Error: Debug; + fn new_surface(&mut self, area: &Rectangle) -> Result; fn render_to(&self, output: &mut S, frame: usize); }