tinytga/
parse_error.rs

1use crate::header::{Bpp, DataType};
2
3/// Possible parse errors
4#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
5#[non_exhaustive]
6pub enum ParseError {
7    /// An error occurred when parsing the color map.
8    ColorMap,
9
10    /// An error occurred when parsing the TGA header.
11    Header,
12
13    /// An error occurred when parsing the TGA footer.
14    Footer,
15
16    /// An unsupported image type value was encountered.
17    UnsupportedImageType(u8),
18
19    /// An unsupported bits per pixel value was encountered.
20    UnsupportedBpp(u8),
21
22    /// Mismatched bits per pixel.
23    ///
24    /// The bit depth of the image doesn't match the depth that was specified
25    /// when `Tga::from_slice` was called.
26    ///
27    /// [`Tga::from_slice`]: struct.Tga.html#method.from_slice
28    MismatchedBpp(u8),
29
30    /// Unsupported combination of image type and bits per pixel.
31    UnsupportedTgaType(DataType, Bpp),
32}