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 InvalidSampleBitLength,
17 UnexpectedEnd,
19}
20
21#[cfg(feature = "std")]
22impl Error for ParseError {}
23
24impl fmt::Display for ParseError {
25 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
26 match &self {
27 ParseError::BadMagic => f.pad("unexpected magic numbers"),
28 ParseError::ZeroWidth => f.pad("zero pixel width"),
29 ParseError::ZeroFaceCount => f.pad("zero face count"),
30 ParseError::InvalidSampleBitLength => f.pad("invalid sample bit length"),
31 ParseError::UnexpectedEnd => f.pad("unexpected end of buffer"),
32 }
33 }
34}