usb_enumeration/
common.rs

1use std::error::Error;
2
3/// Discovered USB device
4#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5pub struct UsbDevice {
6    /// Platform specific unique ID
7    pub id: String,
8    /// Vendor ID
9    pub vendor_id: u16,
10    /// Product ID
11    pub product_id: u16,
12    /// Optional device description
13    pub description: Option<String>,
14    /// Optional serial number
15    pub serial_number: Option<String>,
16}
17
18#[derive(Copy, Clone, Debug)]
19pub struct ParseError;
20
21impl std::fmt::Display for ParseError {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23        write!(f, "Parse Error")?;
24        Ok(())
25    }
26}
27
28impl Error for ParseError {
29    fn source(&self) -> Option<&(dyn Error + 'static)> {
30        None
31    }
32}