about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGenny <gen@nyble.dev>2022-11-24 19:24:37 -0600
committerGenny <gen@nyble.dev>2022-11-24 19:24:37 -0600
commitbc2b83e09ee6c1ed2e75961ff72f2e85579284c4 (patch)
treed3fec0924d15a94c41fdf6477ff0bf200143d19f
parent18c92c66e96be3751fd5457f222b3a2842ed0433 (diff)
downloadgifed-bc2b83e09ee6c1ed2e75961ff72f2e85579284c4.tar.gz
gifed-bc2b83e09ee6c1ed2e75961ff72f2e85579284c4.zip
Move DeocdeError to the bottom of reader
-rw-r--r--gifed/src/reader/mod.rs70
1 files changed, 35 insertions, 35 deletions
diff --git a/gifed/src/reader/mod.rs b/gifed/src/reader/mod.rs
index 68226f9..2620811 100644
--- a/gifed/src/reader/mod.rs
+++ b/gifed/src/reader/mod.rs
@@ -150,41 +150,6 @@ impl GifReader {
 	}
 }
 
-#[derive(Debug)]
-pub enum DecodeError {
-	IoError(std::io::Error),
-	UnknownVersionString,
-	UnexpectedEof,
-	ColorIndexOutOfBounds,
-}
-
-impl Error for DecodeError {}
-impl fmt::Display for DecodeError {
-	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-		match self {
-			DecodeError::IoError(error) => write!(f, "{}", error),
-			DecodeError::UnknownVersionString => {
-				write!(f, "File did not start with a valid header")
-			}
-			DecodeError::UnexpectedEof => {
-				write!(f, "Found the end of the data at a weird spot")
-			}
-			DecodeError::ColorIndexOutOfBounds => {
-				write!(
-					f,
-					"The image contained an index not found in the color table"
-				)
-			}
-		}
-	}
-}
-
-impl From<std::io::Error> for DecodeError {
-	fn from(ioerror: std::io::Error) -> Self {
-		DecodeError::IoError(ioerror)
-	}
-}
-
 struct SmartReader {
 	inner: Vec<u8>,
 	position: usize,
@@ -262,3 +227,38 @@ impl SmartReader {
 		ret
 	}
 }
+
+#[derive(Debug)]
+pub enum DecodeError {
+	IoError(std::io::Error),
+	UnknownVersionString,
+	UnexpectedEof,
+	ColorIndexOutOfBounds,
+}
+
+impl Error for DecodeError {}
+impl fmt::Display for DecodeError {
+	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+		match self {
+			DecodeError::IoError(error) => write!(f, "{}", error),
+			DecodeError::UnknownVersionString => {
+				write!(f, "File did not start with a valid header")
+			}
+			DecodeError::UnexpectedEof => {
+				write!(f, "Found the end of the data at a weird spot")
+			}
+			DecodeError::ColorIndexOutOfBounds => {
+				write!(
+					f,
+					"The image contained an index not found in the color table"
+				)
+			}
+		}
+	}
+}
+
+impl From<std::io::Error> for DecodeError {
+	fn from(ioerror: std::io::Error) -> Self {
+		DecodeError::IoError(ioerror)
+	}
+}