mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Implement Error for TextureValueError
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user