Implement Error for UpdateTextureError.

This commit is contained in:
Kyle Strohbeck
2016-12-09 12:14:28 -06:00
parent fcf43c5166
commit 48cbf37465
+16
View File
@@ -1069,6 +1069,22 @@ impl fmt::Display for UpdateTextureError {
}
}
impl Error for UpdateTextureError {
fn description(&self) -> &str {
use self::UpdateTextureError::*;
match *self {
PitchOverflows(_) => "pitch overflow",
PitchMustBeMultipleOfTwoForFormat(..) => "pitch must be multiple of two",
XMustBeMultipleOfTwoForFormat(..) => "x must be multiple of two",
YMustBeMultipleOfTwoForFormat(..) => "y must be multiple of two",
WidthMustBeMultipleOfTwoForFormat(..) => "width must be multiple of two",
HeightMustBeMultipleOfTwoForFormat(..) => "height must be multiple of two",
SdlError(ref e) => e,
}
}
}
#[derive(Debug)]
pub enum UpdateTextureYUVError {
PitchOverflows { plane: &'static str, value: usize },