render: move Error type into associated types
This commit is contained in:
parent
5c10dcbd7d
commit
132d7c0a33
@ -163,7 +163,8 @@ impl<S: Surface + Default> SurfacePool<S> {
|
|||||||
|
|
||||||
impl<S: Surface + Default> Surfaces for SurfacePool<S> {
|
impl<S: Surface + Default> Surfaces for SurfacePool<S> {
|
||||||
type Surface = 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();
|
let mut surface = S::default();
|
||||||
surface.set_rect(area);
|
surface.set_rect(area);
|
||||||
self.surfaces.push(surface.clone());
|
self.surfaces.push(surface.clone());
|
||||||
|
@ -29,7 +29,8 @@ pub trait Shader: Send + Sync {
|
|||||||
|
|
||||||
pub trait Surfaces: Send + Sync {
|
pub trait Surfaces: Send + Sync {
|
||||||
type Surface: Surface;
|
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);
|
fn render_to<S: Sample>(&self, output: &mut S, frame: usize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user