use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PciError {
InvalidFormat,
InvalidHexValue,
InvalidIndentation,
UnexpectedEndOfInput,
VendorNotFound,
DeviceNotFound,
ClassNotFound,
SubclassNotFound,
ProgInterfaceNotFound,
}
impl fmt::Display for PciError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PciError::InvalidFormat => write!(f, "Invalid format in PCI IDs file"),
PciError::InvalidHexValue => write!(f, "Invalid hexadecimal value"),
PciError::InvalidIndentation => write!(f, "Invalid indentation level"),
PciError::UnexpectedEndOfInput => write!(f, "Unexpected end of input"),
PciError::VendorNotFound => write!(f, "Vendor ID not found"),
PciError::DeviceNotFound => write!(f, "Device ID not found"),
PciError::ClassNotFound => write!(f, "Device class not found"),
PciError::SubclassNotFound => write!(f, "Subclass not found"),
PciError::ProgInterfaceNotFound => write!(f, "Programming interface not found"),
}
}
}
pub type PciResult<T> = Result<T, PciError>;