1use core::fmt;
2#[cfg(feature = "std")]
3use std::error::Error;
4
5#[derive(Debug)]
7#[non_exhaustive]
8pub enum ParseError {
9 BadMagic,
11 ZeroWidth,
13 ZeroFaceCount,
15 UnexpectedEnd,
17}
18
19#[cfg(feature = "std")]
20impl Error for ParseError {}
21
22impl fmt::Display for ParseError {
23 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
24 match &self {
25 ParseError::BadMagic => f.pad("unexpected magic numbers"),
26 ParseError::ZeroWidth => f.pad("zero pixel width"),
27 ParseError::ZeroFaceCount => f.pad("zero face count"),
28 ParseError::UnexpectedEnd => f.pad("unexpected end of buffer"),
29 }
30 }
31}