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