1use core::fmt;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum PciError {
8 InvalidFormat,
10 InvalidHexValue,
12 InvalidIndentation,
14 UnexpectedEndOfInput,
16 VendorNotFound,
18 DeviceNotFound,
20 ClassNotFound,
22 SubclassNotFound,
24 ProgInterfaceNotFound,
26}
27
28impl fmt::Display for PciError {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 PciError::InvalidFormat => write!(f, "Invalid format in PCI IDs file"),
32 PciError::InvalidHexValue => write!(f, "Invalid hexadecimal value"),
33 PciError::InvalidIndentation => write!(f, "Invalid indentation level"),
34 PciError::UnexpectedEndOfInput => write!(f, "Unexpected end of input"),
35 PciError::VendorNotFound => write!(f, "Vendor ID not found"),
36 PciError::DeviceNotFound => write!(f, "Device ID not found"),
37 PciError::ClassNotFound => write!(f, "Device class not found"),
38 PciError::SubclassNotFound => write!(f, "Subclass not found"),
39 PciError::ProgInterfaceNotFound => write!(f, "Programming interface not found"),
40 }
41 }
42}
43
44pub type PciResult<T> = Result<T, PciError>;