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
32
use crate::header::{Bpp, DataType};

/// Possible parse errors
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[non_exhaustive]
pub enum ParseError {
    /// An error occurred when parsing the color map.
    ColorMap,

    /// An error occurred when parsing the TGA header.
    Header,

    /// An error occurred when parsing the TGA footer.
    Footer,

    /// An unsupported image type value was encountered.
    UnsupportedImageType(u8),

    /// An unsupported bits per pixel value was encountered.
    UnsupportedBpp(u8),

    /// Mismatched bits per pixel.
    ///
    /// The bit depth of the image doesn't match the depth that was specified
    /// when `Tga::from_slice` was called.
    ///
    /// [`Tga::from_slice`]: struct.Tga.html#method.from_slice
    MismatchedBpp(u8),

    /// Unsupported combination of image type and bits per pixel.
    UnsupportedTgaType(DataType, Bpp),
}