From f5cd0a0e5a6020a53afa641fe3ccf5fec73d4f93 Mon Sep 17 00:00:00 2001 From: Kyle Strohbeck Date: Fri, 9 Dec 2016 12:52:47 -0600 Subject: [PATCH] Implement Error for UpdateTextureYUVError. --- src/sdl2/render.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/sdl2/render.rs b/src/sdl2/render.rs index f4f1258f..c5a6372b 100644 --- a/src/sdl2/render.rs +++ b/src/sdl2/render.rs @@ -1121,6 +1121,23 @@ impl fmt::Display for UpdateTextureYUVError { } } +impl Error for UpdateTextureYUVError { + fn description(&self) -> &str { + use self::UpdateTextureYUVError::*; + + match *self { + PitchOverflows {..} => "pitch overflow", + InvalidPlaneLength {..} => "invalid plane length", + 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", + RectNotInsideTexture(_) => "rect must be inside texture", + SdlError(ref e) => e, + } + } +} + impl Texture { #[inline] fn check_renderer(&self) {