Debian Codegraph @

src/platform/linux_usbfs/enumeration.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#;
6
7 use logrust-analyzer cargo log 0.4.34 crate/::debugrust-analyzer cargo log 0.4.34 macros/debug!;
8
9 use craterust-analyzer cargo nusb 0.1.13 crate/::enumerationrust-analyzer cargo nusb 0.1.13 enumeration/::InterfaceInforust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#;
10 use craterust-analyzer cargo nusb 0.1.13 crate/::DeviceInforust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#;
11 use craterust-analyzer cargo nusb 0.1.13 crate/::Errorrust-analyzer cargo nusb 0.1.13 Error#;
12 use craterust-analyzer cargo nusb 0.1.13 crate/::Speedrust-analyzer cargo nusb 0.1.13 enumeration/Speed#;
13
14 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
15 pub struct SysfsPathrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#(pub(craterust-analyzer cargo nusb 0.1.13 crate/) PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#);
16
17 impl SysfsPathrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath# {
18 pub(craterust-analyzer cargo nusb 0.1.13 crate/) fn read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().<T: FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#>(&self, attr: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>
19 where
20 T: FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#,
21 T::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static,
22 {
23 let attr_path = self.0rust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#0..joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(attr);
24 let read_res = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(&attr_path);
25 debugrust-analyzer cargo log 0.4.34 macros/debug!!("sysfs read {attr_path:?}: {read_res:?}");
26
27 read_res?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
28 .trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().()
29 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().()
30 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, e))
31 }
32
33 fn read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().<T: FromHexStrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/FromHexStr#>(&self, attr: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> {
34 let s = self.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(attr)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
35 T::from_hex_strrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/FromHexStr#from_hex_str().(&s)
36 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, "invalid hex str"))
37 }
38
39 fn childrenrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]children().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = SysfsPathrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#> {
40 fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().(&self.0rust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#0.)
41 .okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()
42 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][IntoIterator]into_iter().()
43 .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|x| x)
44 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|f| f.okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().())
45 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|f| f.file_typerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_type().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|t| t.is_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[FileType]is_dir().()))
46 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|f| SysfsPathrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#(f.pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().()))
47 }
48 }
49
50 trait FromHexStrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/FromHexStr#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# {
51 fn from_hex_strrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/FromHexStr#from_hex_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Self, ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#>;
52 }
53
54 impl FromHexStrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/FromHexStr# for u8 {
55 fn from_hex_strrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[u8][FromHexStr]from_hex_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[u8][FromHexStr], ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#> {
56 u8::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]from_str_radix().(s, 16)
57 }
58 }
59
60 impl FromHexStrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/FromHexStr# for u16 {
61 fn from_hex_strrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[u16][FromHexStr]from_hex_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[u16][FromHexStr], ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#> {
62 u16::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_str_radix().(s, 16)
63 }
64 }
65
66 const SYSFS_PREFIXrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SYSFS_PREFIX.: &'static str = "/sys/bus/usb/devices/";
67
68 pub fn list_devicesrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/list_devices().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = DeviceInforust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#>, Errorrust-analyzer cargo nusb 0.1.13 Error#> {
69 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().(SYSFS_PREFIXrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SYSFS_PREFIX.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|entry| {
70 let res = probe_devicerust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/probe_device().(SysfsPathrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#(entry.okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().()));
71 if let Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(x) = &res {
72 debugrust-analyzer cargo log 0.4.34 macros/debug!!("failed to probe, skipping: {x}")
73 }
74 res.okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()
75 }))
76 }
77
78 pub fn probe_devicerust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/probe_device().(path: SysfsPathrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<DeviceInforust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#, Errorrust-analyzer cargo nusb 0.1.13 Error#> {
79 debugrust-analyzer cargo log 0.4.34 macros/debug!!("probe device {path:?}");
80 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(DeviceInforust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo# {
81 bus_numberrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#bus_number.: path.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().("busnum")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
82 device_addressrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#device_address.: path.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().("devnum")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
83 vendor_idrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#vendor_id.: path.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("idVendor")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
84 product_idrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#product_id.: path.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("idProduct")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
85 device_versionrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#device_version.: path.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bcdDevice")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
86 classrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#class.: path.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bDeviceClass")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
87 subclassrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#subclass.: path.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bDeviceSubClass")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
88 protocolrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#protocol.: path.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bDeviceProtocol")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
89 speedrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#speed.: path
90 .read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("speed")
91 .okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()
92 .as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().()
93 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(Speedrust-analyzer cargo nusb 0.1.13 enumeration/Speed#::from_strrust-analyzer cargo nusb 0.1.13 enumeration/impl#[Speed]from_str().),
94 manufacturer_stringrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#manufacturer_string.: path.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().("manufacturer").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(),
95 product_stringrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#product_string.: path.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().("product").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(),
96 serial_numberrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#serial_number.: path.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().("serial").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(),
97 interfacesrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#interfaces.: {
98 let mut interfaces: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = path
99 .childrenrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]children().()
100 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|i| {
101 // Skip subdirectories like `power` that aren't interfaces
102 // (they would be skipped when missing required properties,
103 // but might as well not open them)
104 i.0rust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/SysfsPath#0..file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_name().()
105 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().()
106 .as_encoded_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]as_encoded_bytes().()
107 .containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&b':')
108 })
109 .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|i| {
110 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(InterfaceInforust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo# {
111 interface_numberrust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#interface_number.: i.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bInterfaceNumber").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().,
112 classrust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#class.: i.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bInterfaceClass").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().,
113 subclassrust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#subclass.: i.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bInterfaceSubClass").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().,
114 protocolrust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#protocol.: i.read_attr_hexrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr_hex().("bInterfaceProtocol").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().,
115 interface_stringrust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#interface_string.: i.read_attrrust-analyzer cargo nusb 0.1.13 platform/linux_usbfs/enumeration/impl#[SysfsPath]read_attr().("interface").okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(),
116 })
117 })
118 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
119 interfaces.sort_unstable_by_keyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable_by_key().(|i| i.interface_numberrust-analyzer cargo nusb 0.1.13 enumeration/InterfaceInfo#interface_number.);
120 interfaces
121 },
122 pathrust-analyzer cargo nusb 0.1.13 enumeration/DeviceInfo#path.,
123 })
124 }