Implement Error for TextureValueError

This commit is contained in:
Kevin Fuller
2016-06-30 09:28:50 -07:00
parent 5216499307
commit fb1bff71eb
+14
View File
@@ -35,6 +35,7 @@ use pixels;
use pixels::PixelFormatEnum;
use get_error;
use std::fmt;
use std::error::Error;
use std::mem;
use std::ptr;
use libc::{c_int, uint32_t, c_double, c_void};
@@ -356,6 +357,19 @@ impl fmt::Display for TextureValueError {
}
}
impl Error for TextureValueError {
fn description(&self) -> &str {
use self::TextureValueError::*;
match *self {
WidthOverflows(_) => "texture width overflow",
HeightOverflows(_) => "texture height overflow",
WidthMustBeMultipleOfTwoForFormat(..) => "texture width must be multiple of two",
SdlError(ref e) => e,
}
}
}
/// Texture-creating methods for the renderer
impl<'a> Renderer<'a> {
/// Creates a texture for a rendering context.