Debian Codegraph @

src/enumerate.rs

raw symbols SCIP
1 //! Lookup and sort `sys` devices.
2 //!
3 //! Lookup devices in the `sys` filesystem, filter devices by properties,
4 //! and return a sorted list of devices.
5 //!
6 //! From [`libudev-enumerate`](https://github.com/eudev-project/eudev/blob/master/src/libudev/libudev-enumerate.c) documentation.
7
8 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/, syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#};
9
10 use craterust-analyzer cargo udevrs 0.4.0 crate/::utilrust-analyzer cargo udevrs 0.4.0 util/;
11 use craterust-analyzer cargo udevrs 0.4.0 crate/::UDEV_ROOT_RUNrust-analyzer cargo udevrs 0.4.0 monitor/UDEV_ROOT_RUN.;
12 use craterust-analyzer cargo udevrs 0.4.0 crate/::{Errorrust-analyzer cargo udevrs 0.4.0 error/Error#, Resultrust-analyzer cargo udevrs 0.4.0 error/Result#, Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#, UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#, UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#, UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#, UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#};
13
14 const LOG_PREFIXrust-analyzer cargo udevrs 0.4.0 enumerate/LOG_PREFIX.: &str = "udev enumerate:";
15
16 /// Represents the file path in the `sys` filesystem.
17 #[repr(C)]
18 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
19 pub struct Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath# {
20 syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#syspath.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
21 }
22
23 impl Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath# {
24 /// Creates a new [Syspath].
25 pub const fn newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]new().() -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath] {
26 Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath] {
27 syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#syspath.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
28 }
29 }
30
31 /// Gets a reference to the syspath string.
32 pub fn syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]syspath().(&self) -> &str {
33 self.syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#syspath..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
34 }
35
36 /// Sets the syspath.
37 pub fn set_syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]set_syspath().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>(&mut self, syspath: S) {
38 self.syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#syspath. = syspath.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
39 }
40
41 /// Builder function that sets the syspath.
42 pub fn with_syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]with_syspath().<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>(mut self, syspath: S) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath] {
43 self.set_syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]set_syspath().(syspath);
44 self
45 }
46 }
47
48 /// Represents one device lookup/sort context..
49 #[repr(C)]
50 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
51 pub struct UdevEnumeraterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate# {
52 udevrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#udev.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>,
53 sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
54 sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
55 subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
56 subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
57 sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
58 properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
59 tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
60 devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
61 parentrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#parent.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#>>,
62 devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#>,
63 devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur.: usize,
64 devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max.: usize,
65 devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_uptodate.: bool,
66 match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#match_is_initialized.: bool,
67 }
68
69 impl UdevEnumeraterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate# {
70 /// Creates a new [UdevEnumerate].
71 pub fn newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]new().(udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
72 let sysattr_match_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
73 let sysattr_nomatch_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
74 let subsystem_match_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
75 let subsystem_nomatch_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
76 let sysname_match_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
77 let properties_match_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
78 let tags_match_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
79 let devices_list = UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
80
81 Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
82 udevrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#udev.,
83 sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.,
84 sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list.,
85 subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list.,
86 subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list.,
87 sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list.,
88 properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list.,
89 tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list.,
90 devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_list.,
91 parentrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#parent.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
92 devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
93 devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur.: 0,
94 devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max.: 0,
95 devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_uptodate.: false,
96 match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#match_is_initialized.: false,
97 }
98 }
99
100 /// Gets a reference to the [Udev] object.
101 pub fn udevrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]udev().(&self) -> &Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#> {
102 &self.udevrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#udev.
103 }
104
105 /// Gets a reference to the sysattr match list [UdevList].
106 pub const fn sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_match_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
107 &self.sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.
108 }
109
110 /// Gets a mutable reference to the sysattr match list [UdevList].
111 pub fn sysattr_match_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_match_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
112 &mut self.sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.
113 }
114
115 /// Sets the sysattr match list [UdevList].
116 pub fn set_sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysattr_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
117 self.sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
118 }
119
120 /// Builder function that sets the sysattr match list [UdevList].
121 pub fn with_sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_sysattr_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
122 self.set_sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysattr_match_list().(list);
123 self
124 }
125
126 /// Adds an entry to the match sysattr [UdevEntry] list.
127 ///
128 /// From the `libudev` documentation:
129 ///
130 /// ```no_build,no_run
131 /// Match only devices with a given /sys device attribute.
132 /// ```
133 ///
134 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
135 pub fn add_match_sysattrrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_match_sysattr().(&mut self, sysattr: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
136 if sysattr.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
137 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("sysattr is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
138 } else {
139 self.sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.
140 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(sysattr, "")
141 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(
142 "unable to add match sysattr entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
143 ))
144 }
145 }
146
147 /// Gets a reference to the sysattr nomatch list [UdevList].
148 pub const fn sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_nomatch_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
149 &self.sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list.
150 }
151
152 /// Gets a mutable reference to the sysattr nomatch list [UdevList].
153 pub fn sysattr_nomatch_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_nomatch_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
154 &mut self.sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list.
155 }
156
157 /// Sets the sysattr nomatch list [UdevList].
158 pub fn set_sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysattr_nomatch_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
159 self.sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
160 }
161
162 /// Builder function that sets the sysattr nomatch list [UdevList].
163 pub fn with_sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_sysattr_nomatch_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
164 self.set_sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysattr_nomatch_list().(list);
165 self
166 }
167
168 /// Adds an entry to the no-match sysattr [UdevEntry] list.
169 ///
170 /// From the `libudev` documentation:
171 ///
172 /// ```no_build,no_run
173 /// Match only devices without a given /sys device attribute.
174 /// ```
175 ///
176 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
177 pub fn add_nomatch_sysattrrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_nomatch_sysattr().(&mut self, sysattr: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
178 if sysattr.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
179 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("sysattr is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
180 } else {
181 self.sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list.
182 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(sysattr, "")
183 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(
184 "unable to add no-match sysattr entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
185 ))
186 }
187 }
188
189 /// Gets a reference to the subsystem match list [UdevList].
190 pub const fn subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_match_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
191 &self.subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list.
192 }
193
194 /// Gets a mutable reference to the subsystem match list [UdevList].
195 pub fn subsystem_match_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_match_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
196 &mut self.subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list.
197 }
198
199 /// Sets the subsystem match list [UdevList].
200 pub fn set_subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_subsystem_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
201 self.subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
202 }
203
204 /// Builder function that sets the subsystem match list [UdevList].
205 pub fn with_subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_subsystem_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
206 self.set_subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_subsystem_match_list().(list);
207 self
208 }
209
210 /// Adds an entry to the match subsystem [UdevEntry] list.
211 ///
212 /// From the `libudev` documentation:
213 ///
214 /// ```no_build,no_run
215 /// Match only devices belonging to a certain kernel subsystem.
216 /// ```
217 ///
218 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
219 pub fn add_match_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_match_subsystem().(&mut self, subsystem: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
220 if subsystem.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
221 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("subsystem is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
222 } else {
223 self.subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list.
224 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(subsystem, "")
225 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(
226 "unable to add match subsystem entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
227 ))
228 }
229 }
230
231 /// Gets a reference to the subsystem nomatch list [UdevList].
232 pub const fn subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_nomatch_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
233 &self.subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list.
234 }
235
236 /// Gets a mutable reference to the subsystem nomatch list [UdevList].
237 pub fn subsystem_nomatch_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_nomatch_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
238 &mut self.subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list.
239 }
240
241 /// Sets the subsystem nomatch list [UdevList].
242 pub fn set_subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_subsystem_nomatch_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
243 self.subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
244 }
245
246 /// Builder function that sets the subsystem nomatch list [UdevList].
247 pub fn with_subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_subsystem_nomatch_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
248 self.set_subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_subsystem_nomatch_list().(list);
249 self
250 }
251
252 /// Adds an entry to the no-match subsystem [UdevEntry] list.
253 ///
254 /// From the `libudev` documentation:
255 ///
256 /// ```no_build,no_run
257 /// Match only devices not belonging to a certain kernel subsystem.
258 /// ```
259 ///
260 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
261 pub fn add_nomatch_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_nomatch_subsystem().(&mut self, subsystem: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
262 if subsystem.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
263 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("subsystem is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
264 } else {
265 self.subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list.
266 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(subsystem, "")
267 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(
268 "unable to add no-match subsystem entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
269 ))
270 }
271 }
272
273 /// Gets a reference to the sysname match list [UdevList].
274 pub const fn sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysname_match_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
275 &self.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list.
276 }
277
278 /// Gets a mutable reference to the sysname match list [UdevList].
279 pub fn sysname_match_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysname_match_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
280 &mut self.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list.
281 }
282
283 /// Sets the sysname match list [UdevList].
284 pub fn set_sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysname_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
285 self.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
286 }
287
288 /// Builder function that sets the sysname match list [UdevList].
289 pub fn with_sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_sysname_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
290 self.set_sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysname_match_list().(list);
291 self
292 }
293
294 /// Adds an entry to the match sysname [UdevEntry] list.
295 ///
296 /// From the `libudev` documentation:
297 ///
298 /// ```no_build,no_run
299 /// Match only devices with a given /sys device name.
300 /// ```
301 ///
302 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
303 pub fn add_match_sysnamerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_match_sysname().(&mut self, sysname: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
304 if sysname.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
305 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("sysname is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
306 } else {
307 self.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list.
308 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(sysname, "")
309 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(
310 "unable to add match sysname entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
311 ))
312 }
313 }
314
315 /// Gets a reference to the properties match list [UdevList].
316 pub const fn properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]properties_match_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
317 &self.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list.
318 }
319
320 /// Gets a mutable reference to the properties match list [UdevList].
321 pub fn properties_match_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]properties_match_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
322 &mut self.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list.
323 }
324
325 /// Sets the properties match list [UdevList].
326 pub fn set_properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_properties_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
327 self.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
328 }
329
330 /// Builder function that sets the properties match list [UdevList].
331 pub fn with_properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_properties_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
332 self.set_properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_properties_match_list().(list);
333 self
334 }
335
336 /// Adds an entry to the match properties [UdevEntry] list.
337 ///
338 /// From the `libudev` documentation:
339 ///
340 /// ```no_build,no_run
341 /// Match only devices with a certain property.
342 /// ```
343 ///
344 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
345 pub fn add_match_propertyrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_match_property().(&mut self, property: &str, value: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
346 if property.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
347 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("property is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
348 } else {
349 self.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list.
350 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(property, value)
351 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(
352 "unable to add match property entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
353 ))
354 }
355 }
356
357 /// Gets a reference to the tags match list [UdevList].
358 pub const fn tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]tags_match_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
359 &self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list.
360 }
361
362 /// Gets a mutable reference to the tags match list [UdevList].
363 pub fn tags_match_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]tags_match_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
364 &mut self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list.
365 }
366
367 /// Sets the tags match list [UdevList].
368 pub fn set_tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_tags_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
369 self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
370 }
371
372 /// Builder function that sets the tags match list [UdevList].
373 pub fn with_tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_tags_match_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
374 self.set_tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_tags_match_list().(list);
375 self
376 }
377
378 /// Adds an entry to the match tags [UdevEntry] list.
379 ///
380 /// From the `libudev` documentation:
381 ///
382 /// ```no_build,no_run
383 /// Match only devices with a certain tag.
384 /// ```
385 ///
386 /// Returns `Ok(UdevEntry)` on success, `Err(Error)` otherwise.
387 pub fn add_match_tagrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_match_tag().(&mut self, tag: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
388 if tag.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
389 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("tag is null".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
390 } else {
391 self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list.
392 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(tag, "")
393 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("unable to add match tag entry".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
394 }
395 }
396
397 /// Gets a reference to the devices list [UdevList].
398 pub const fn devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
399 &self.devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_list.
400 }
401
402 /// Gets a mutable reference to the devices list [UdevList].
403 pub fn devices_list_mutrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
404 &mut self.devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_list.
405 }
406
407 /// Sets the devices list [UdevList].
408 pub fn set_devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(&mut self, list: L) {
409 self.devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list);
410 }
411
412 /// Builder function that sets the devices list [UdevList].
413 pub fn with_devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut self, list: L) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
414 self.set_devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_list().(list);
415 self
416 }
417
418 /// Gets an optional reference to the parent [UdevDevice].
419 pub fn parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]parent().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#>> {
420 self.parentrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#parent..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
421 }
422
423 /// Sets the parent [UdevDevice].
424 pub fn set_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_parent().(&mut self, parent: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#>) {
425 self.parentrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#parent..replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]replace().(parent);
426 }
427
428 /// Builder function that sets the parent [UdevDevice].
429 pub fn with_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_parent().(mut self, parent: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#>) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
430 self.set_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_parent().(parent);
431 self
432 }
433
434 /// Gets a reference to the [Syspath] devices list.
435 pub fn devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices().(&self) -> &[Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#] {
436 self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices..as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`AsRef<[T]>`]as_ref().()
437 }
438
439 /// Sets the [Syspath] devices list.
440 pub fn set_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices().<S: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#>>(&mut self, devices: S) {
441 self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices. = devices.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
442 }
443
444 /// Builder function that sets the [Syspath] devices list.
445 pub fn with_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices().<S: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#>>(mut self, devices: S) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
446 self.set_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices().(devices);
447 self
448 }
449
450 /// Gets the current index into the [Syspath] devices list.
451 pub const fn devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_cur().(&self) -> usize {
452 self.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur.
453 }
454
455 /// Sets the current index into the [Syspath] devices list.
456 ///
457 /// **NOTE**: `cur` must be in-bounds to set the current index, otherwise this function is a
458 /// no-op.
459 pub fn set_devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_cur().(&mut self, cur: usize) {
460 if cur rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() {
461 self.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur. = cur;
462 }
463 }
464
465 /// Builder function that sets the current index into the [Syspath] devices list.
466 ///
467 /// **NOTE**: `cur` must be in-bounds to set the current index, otherwise this function is a
468 /// no-op.
469 pub fn with_devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_cur().(mut self, cur: usize) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
470 self.set_devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_cur().(cur);
471 self
472 }
473
474 /// Gets the maximum number of [Syspath] devices.
475 pub const fn devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_max().(&self) -> usize {
476 self.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max.
477 }
478
479 /// Sets the maximum number of [Syspath] devices.
480 ///
481 /// **NOTE** if `max` is greater than the current [Syspath] devices list capacity,
482 /// additional space will be reserved to avoid frequent reallocations.
483 pub fn set_devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_max().(&mut self, max: usize) {
484 self.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max. = max;
485 let cap = self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices..capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().();
486 self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices..reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(self.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max..saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(cap));
487 }
488
489 /// Builder function that sets the maximum number of [Syspath] devices.
490 ///
491 /// **NOTE** if `max` is greater than the current [Syspath] devices list capacity,
492 /// additional space will be reserved to avoid frequent reallocations.
493 pub fn with_devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_max().(mut self, max: usize) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
494 self.set_devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_max().(max);
495 self
496 }
497
498 /// Gets whether the [Syspath] devices list is up-to-date.
499 pub const fn devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_uptodate().(&self) -> bool {
500 self.devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_uptodate.
501 }
502
503 /// Sets whether the [Syspath] devices list is up-to-date.
504 pub fn set_devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_uptodate().(&mut self, val: bool) {
505 self.devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_uptodate. = val;
506 }
507
508 /// Builder function that sets whether the [Syspath] devices list is up-to-date.
509 pub fn with_devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_uptodate().(mut self, val: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
510 self.set_devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_uptodate().(val);
511 self
512 }
513
514 /// Gets whether the match lists are initialized.
515 pub const fn match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_is_initialized().(&self) -> bool {
516 self.match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#match_is_initialized.
517 }
518
519 /// Sets whether the match lists are initialized.
520 pub fn set_match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_match_is_initialized().(&mut self, val: bool) {
521 self.match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#match_is_initialized. = val;
522 }
523
524 /// Builder function that sets whether the match lists are initialized.
525 pub fn with_match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_match_is_initialized().(mut self, val: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate] {
526 self.set_match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_match_is_initialized().(val);
527 self
528 }
529
530 /// Adds a devices to the list of devices.
531 ///
532 /// From the `libudev` documentation:
533 ///
534 /// ```no_build,no_run
535 /// Add a device to the list of devices, to retrieve it back sorted in dependency order.
536 /// ```
537 ///
538 /// Returns: `Ok(())` on success, `Err(Error)` otherwise.
539 pub fn add_syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_syspath().(&mut self, syspath: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
540 if syspath.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
541 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("empty syspath".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
542 } else {
543 let dev = UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#::new_from_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_syspath().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&self.udevrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#udev.), syspath)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
544 self.syspath_addrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]syspath_add().(dev.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().())
545 }
546 }
547
548 fn syspath_addrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]syspath_add().(&mut self, syspath: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
549 if self.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().self.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max. {
550 self.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max. = self.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_max..saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(1024);
551 self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices..reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(1024);
552 }
553
554 self.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#::newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]new().().with_syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]with_syspath().(syspath));
555
556 self.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur. = self.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_cur..saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(1);
557 self.devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#devices_uptodate. = false;
558
559 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
560 }
561
562 /// Scan `/sys` for devices which match the given filters.
563 ///
564 /// From the `libudev` documentation:
565 ///
566 /// ```no_build,no_run
567 /// Scan /sys for all devices which match the given filters. No matches
568 /// will return all currently available devices.
569 /// ```
570 ///
571 /// Returns: `Ok(())` on success, `Err(Error)` otherwise.
572 pub fn scan_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
573 if self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list..entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]entry().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
574 self.scan_devices_tagsrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices_tags().()
575 } else if self.parentrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#parent..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
576 self.scan_devices_childrenrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices_children().()
577 } else {
578 self.scan_devices_allrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices_all().()
579 }
580 }
581
582 fn scan_devices_tagsrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices_tags().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
583 // scan only tagged devices.
584 // use tags reverse-index, instead of searching all deivces in /sys
585 let mut add_syspaths: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
586
587 for list_entry in self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list..iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().() {
588 let tag_name = list_entry.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().();
589 let path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{UDEV_ROOT_RUN}/udev/tags/{tag_name}");
590
591 for dir_entry in 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().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
592 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to open tags path: {err}")))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
593 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|e| e.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().())
594 {
595 let d_name = dir_entry?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
596 .file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().()
597 .into_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_string().()
598 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().());
599 if d_name.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
600 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} empty/invalid entry");
601 } else if d_name.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('.') {
602 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} private entry");
603 } else {
604 let mut dev =
605 UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#::new_from_device_idrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_device_id().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&self.udevrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#udev.), d_name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
606 let dev_syspath = dev.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().();
607
608 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_subsystem().(dev.subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]subsystem().()) {
609 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no subsystem match");
610 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_sysnamerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysname().(dev.sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysname().()) {
611 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no sysname match");
612 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_parent().(&dev) {
613 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no parent match");
614 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_propertyrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_property().(&dev) {
615 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no property match");
616 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_sysattrrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysattr().(&mut dev) {
617 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no sys attribute match");
618 } else {
619 add_syspaths.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(dev_syspath);
620 }
621 }
622 }
623 }
624
625 for path in add_syspaths.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
626 self.syspath_addrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]syspath_add().(path)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
627 }
628
629 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
630 }
631
632 fn match_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_subsystem().(&self, subsystem: &str) -> bool {
633 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().subsystem.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().()
634 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self
635 .subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_nomatch_list.
636 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
637 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|f| f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().subsystem)
638 && (self.subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list..is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().()
639 || self
640 .subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#subsystem_match_list.
641 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
642 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|f| f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().subsystem))
643 }
644
645 fn match_sysnamerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysname().(&self, sysname: &str) -> bool {
646 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().sysname.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().()
647 && (self.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list..is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().()
648 || self.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysname_match_list..iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|f| f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().sysname))
649 }
650
651 fn match_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_parent().(&self, dev: &UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#) -> bool {
652 match self.parentrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#parent..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() {
653 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parent) => dev.devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().().starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(parent.devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().()),
654 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => true,
655 }
656 }
657
658 fn match_tagrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_tag().(&self, dev: &mut UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#) -> bool {
659 // no match always matches
660 self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list..is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().() ||
661 // loop over matches
662 // if any tag is a mismatch, return false
663 self.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#tags_match_list..iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|f| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dev.has_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]has_tag().(f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().())).countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]count().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0
664 }
665
666 fn match_propertyrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_property().(&self, dev: &UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#) -> bool {
667 if self.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list..is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().() {
668 true
669 } else {
670 let mut ret = false;
671 for list_entry in self.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#properties_match_list..iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().() {
672 let match_key = list_entry.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().();
673 let match_value = list_entry.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().();
674
675 for property_entry in dev.properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]properties_list().().iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().() {
676 let dev_key = property_entry.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().();
677 let dev_value = property_entry.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().();
678
679 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(key_pattern) = globrust-analyzer cargo glob 0.3.2 crate/::Patternrust-analyzer cargo glob 0.3.2 Pattern#::newrust-analyzer cargo glob 0.3.2 impl#[Pattern]new().(match_key) {
680 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().key_pattern.matchesrust-analyzer cargo glob 0.3.2 impl#[Pattern]matches().(dev_key) {
681 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!(
682 "no key match found, entry key: {match_key}, device key {dev_key}"
683 );
684 } else if match_value.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && dev_value.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
685 ret = true;
686 break;
687 } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(val_pattern) = globrust-analyzer cargo glob 0.3.2 crate/::Patternrust-analyzer cargo glob 0.3.2 Pattern#::newrust-analyzer cargo glob 0.3.2 impl#[Pattern]new().(match_value) {
688 if val_pattern.matchesrust-analyzer cargo glob 0.3.2 impl#[Pattern]matches().(dev_value) {
689 ret = true;
690 break;
691 }
692 } else {
693 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("no value match found, entry value: {match_value}, device value: {dev_value}");
694 }
695 }
696 }
697
698 if ret {
699 break;
700 }
701 }
702
703 ret
704 }
705 }
706
707 fn match_sysattrrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysattr().(&self, dev: &mut UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#) -> bool {
708 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self
709 .sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_nomatch_list.
710 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
711 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|f| dev.match_sysattr_valuerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevDevice]match_sysattr_value().(f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().(), f.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().()))
712 && self
713 .sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.
714 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
715 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|f| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().dev.match_sysattr_valuerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevDevice]match_sysattr_value().(f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().(), f.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().()))
716 .countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]count().()
717 ==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0
718 && self
719 .sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#sysattr_match_list.
720 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
721 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|f| dev.match_sysattr_valuerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevDevice]match_sysattr_value().(f.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().(), f.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().()))
722 }
723
724 fn scan_devices_childrenrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices_children().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
725 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("unimplemented".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
726 }
727
728 fn scan_devices_allrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_devices_all().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
729 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#("unimplemented".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
730 }
731
732 /// Scans `/sys` for all kernel subsystems.
733 ///
734 /// From `libudev` documentation:
735 ///
736 /// ```no_build,no_run
737 /// Scan /sys for all kernel subsystems, including buses, classes, drivers.
738 /// ```
739 ///
740 /// Returns: `Ok(())` on success, `Err(Error)` otherwise.
741 pub fn scan_subsystemsrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_subsystems().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
742 // all kernel modules
743 if self.match_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_subsystem().("module") {
744 self.scan_dir_and_add_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_dir_and_add_devices().("module", "", "")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
745 }
746
747 let subsysdir = if fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::metadatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/metadata().("/sys/subsystem").is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
748 "subsystem"
749 } else {
750 "bus"
751 };
752
753 // all subsystems (only buses support coldplug)
754 if self.match_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_subsystem().("subsystem") {
755 self.scan_dir_and_add_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_dir_and_add_devices().(subsysdir, "", "")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
756 }
757
758 // all subsystem drivers
759 if self.match_subsystemrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_subsystem().("drivers") {
760 self.scan_dirrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_dir().(subsysdir, "drivers", "drivers")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
761 }
762
763 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
764 }
765
766 fn scan_dir_and_add_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_dir_and_add_devices().(
767 &mut self,
768 basedir: &str,
769 subdir1: &str,
770 subdir2: &str,
771 ) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
772 let path = if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().subdir1.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().subdir2.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
773 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/{basedir}/{subdir1}/{subdir2}")
774 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().subdir1.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
775 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/{basedir}/{subdir1}")
776 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().subdir2.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
777 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/{basedir}/{subdir2}")
778 } else {
779 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/{basedir}")
780 };
781
782 let mut add_syspaths: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
783
784 for dir_entry in 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().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
785 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to open {path} path: {err}")))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
786 {
787 let d_name = dir_entry?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
788 .file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().()
789 .into_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_string().()
790 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().());
791
792 if d_name.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
793 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} empty/invalid entry");
794 } else if d_name.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('.') {
795 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} private entry");
796 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_sysnamerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysname().(d_name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) {
797 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no /sys name match");
798 } else {
799 let syspath = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{path}/{d_name}");
800 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mut dev) =
801 UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#::new_from_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_syspath().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&self.udevrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#udev.), syspath.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
802 {
803 if self.match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#match_is_initialized. {
804 // From `libudev` documentation:
805 //
806 // ```
807 // All devices with a device node or network interfaces
808 // possibly need udev to adjust the device node permission
809 // or context, or rename the interface before it can be
810 // reliably used from other processes.
811 //
812 // For now, we can only check these types of devices, we
813 // might not store a database, and have no way to find out
814 // for all other types of devices.
815 // ```
816 if dev.get_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_is_initialized().()
817 && (utilrust-analyzer cargo udevrs 0.4.0 util/::majorrust-analyzer cargo udevrs 0.4.0 util/major().(dev.devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnum().()) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 || dev.get_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_ifindex().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().0)
818 {
819 break;
820 }
821 }
822 let dev_syspath = dev.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().();
823 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_parent().(&dev) {
824 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no parent match");
825 break;
826 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_tagrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_tag().(&mut dev) {
827 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no tag match");
828 break;
829 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_propertyrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_property().(&dev) {
830 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no property match");
831 break;
832 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_sysattrrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysattr().(&mut dev) {
833 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no /sys attribute match");
834 break;
835 } else {
836 add_syspaths.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(dev_syspath);
837 }
838 }
839 }
840 }
841
842 for syspath in add_syspaths.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
843 self.add_syspathrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]add_syspath().(syspath)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
844 }
845
846 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
847 }
848
849 fn scan_dirrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_dir().(&mut self, basedir: &str, subdir: &str, subsystem: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
850 let path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/{basedir}");
851
852 for dir_entry in 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().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
853 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevEnumeraterust-analyzer cargo udevrs 0.4.0 error/Error#UdevEnumerate#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to open {path} path: {err}")))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
854 {
855 let d_name = dir_entry?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
856 .file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().()
857 .into_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_string().()
858 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().());
859
860 if d_name.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
861 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} empty/invalid entry");
862 } else if d_name.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('.') {
863 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} private entry");
864 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.match_sysnamerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_sysname().(if subsystem.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
865 d_name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
866 } else {
867 subsystem
868 }) {
869 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("{LOG_PREFIX} no /sys subsystem name match");
870 } else {
871 self.scan_dir_and_add_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]scan_dir_and_add_devices().(basedir, d_name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), subdir)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
872 }
873 }
874
875 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
876 }
877 }
878
879 impl UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice# {
880 pub(craterust-analyzer cargo udevrs 0.4.0 crate/) fn match_sysattr_valuerust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevDevice]match_sysattr_value().(&mut self, sysattr: &str, match_val: &str) -> bool {
881 match self.get_sysattr_valuerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_sysattr_value().(sysattr) {
882 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(val) => {
883 if match_val.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
884 true
885 } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(pattern) = globrust-analyzer cargo glob 0.3.2 crate/::Patternrust-analyzer cargo glob 0.3.2 Pattern#::newrust-analyzer cargo glob 0.3.2 impl#[Pattern]new().(match_val) {
886 pattern.matchesrust-analyzer cargo glob 0.3.2 impl#[Pattern]matches().(val.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
887 } else {
888 false
889 }
890 }
891 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => false,
892 }
893 }
894 }
895
896 #[cfg(test)]
897 mod testsrust-analyzer cargo udevrs 0.4.0 enumerate/tests/ {
898 use superrust-analyzer cargo udevrs 0.4.0 enumerate/::*;
899 use craterust-analyzer cargo udevrs 0.4.0 crate/::UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#;
900
901 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
902 fn test_udev_enumeraterust-analyzer cargo udevrs 0.4.0 enumerate/tests/test_udev_enumerate().() {
903 let udev = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::newrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]new().());
904
905 let mut null_enum = UdevEnumeraterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#::newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev));
906
907 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_enum.udevrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]udev().(), &udev);
908 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_match_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
909 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_nomatch_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
910 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_match_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
911 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_nomatch_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
912 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysname_match_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
913 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]properties_match_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
914 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]tags_match_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
915 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
916 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]parent().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
917 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_enum.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
918 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_enum.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_cur().(), 0);
919 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_enum.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_max().(), 0);
920 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().null_enum.devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_uptodate().());
921 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().null_enum.match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_is_initialized().());
922
923 let exp_sysattr_match_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_sysattr_match_list")];
924 let exp_sysattr_nomatch_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_sysattr_nomatch_list")];
925 let exp_subsystem_match_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_subsystem_match_list")];
926 let exp_subsystem_nomatch_list =
927 [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_subsystem_nomatch_list")];
928 let exp_sysname_match_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_sysname_match_list")];
929 let exp_properties_match_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_properties_match_list")];
930 let exp_tags_match_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_tags_match_list")];
931 let exp_devices_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_devices_list")];
932 let exp_parent = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#::newrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev)));
933 let exp_devices = [Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#::newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]new().(), Syspathrust-analyzer cargo udevrs 0.4.0 enumerate/Syspath#::newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[Syspath]new().()];
934 let exp_devices_cur = 1;
935 let exp_devices_max = 4;
936 let exp_devices_uptodate = true;
937 let exp_match_is_initialized = true;
938
939 let exp_enum = UdevEnumeraterust-analyzer cargo udevrs 0.4.0 enumerate/UdevEnumerate#::newrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]new().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&udev))
940 .with_sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_sysattr_match_list().(exp_sysattr_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
941 .with_sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_sysattr_nomatch_list().(exp_sysattr_nomatch_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
942 .with_subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_subsystem_match_list().(exp_subsystem_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
943 .with_subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_subsystem_nomatch_list().(exp_subsystem_nomatch_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
944 .with_sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_sysname_match_list().(exp_sysname_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
945 .with_properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_properties_match_list().(exp_properties_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
946 .with_tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_tags_match_list().(exp_tags_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
947 .with_devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_list().(exp_devices_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
948 .with_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_parent().(exp_parent.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().())
949 .with_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices().(exp_devices.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
950 .with_devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_cur().(exp_devices_cur)
951 .with_devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_max().(exp_devices_max)
952 .with_devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_devices_uptodate().(exp_devices_uptodate)
953 .with_match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]with_match_is_initialized().(exp_match_is_initialized);
954
955 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.udevrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]udev().(), &udev);
956
957 for iter in [
958 exp_enum
959 .sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_match_list().()
960 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
961 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_sysattr_match_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
962 exp_enum
963 .sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysattr_nomatch_list().()
964 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
965 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_sysattr_nomatch_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
966 exp_enum
967 .subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_match_list().()
968 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
969 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_subsystem_match_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
970 exp_enum
971 .subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]subsystem_nomatch_list().()
972 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
973 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_subsystem_nomatch_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
974 exp_enum
975 .sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]sysname_match_list().()
976 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
977 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_sysname_match_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
978 exp_enum
979 .properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]properties_match_list().()
980 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
981 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_properties_match_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
982 exp_enum
983 .tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]tags_match_list().()
984 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
985 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_tags_match_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
986 exp_enum.devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_list().().iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_devices_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()),
987 ] {
988 for (entry, exp_entry) in iter {
989 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(entry, exp_entry);
990 }
991 }
992
993 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]parent().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&exp_parent));
994 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices().(), exp_devices.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().());
995 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_cur().(), exp_devices_cur);
996 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_max().(), exp_devices_max);
997 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]devices_uptodate().(), exp_devices_uptodate);
998 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_enum.match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]match_is_initialized().(), exp_match_is_initialized);
999
1000 null_enum.set_sysattr_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysattr_match_list().(exp_sysattr_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1001 null_enum.set_sysattr_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysattr_nomatch_list().(exp_sysattr_nomatch_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1002 null_enum.set_subsystem_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_subsystem_match_list().(exp_subsystem_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1003 null_enum.set_subsystem_nomatch_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_subsystem_nomatch_list().(exp_subsystem_nomatch_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1004 null_enum.set_sysname_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_sysname_match_list().(exp_sysname_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1005 null_enum.set_properties_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_properties_match_list().(exp_properties_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1006 null_enum.set_tags_match_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_tags_match_list().(exp_tags_match_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1007 null_enum.set_devices_listrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_list().(exp_devices_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1008 null_enum.set_parentrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_parent().(exp_parent.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().());
1009 null_enum.set_devicesrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices().(exp_devices.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
1010 null_enum.set_devices_currust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_cur().(exp_devices_cur);
1011 null_enum.set_devices_maxrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_max().(exp_devices_max);
1012 null_enum.set_devices_uptodaterust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_devices_uptodate().(exp_devices_uptodate);
1013 null_enum.set_match_is_initializedrust-analyzer cargo udevrs 0.4.0 enumerate/impl#[UdevEnumerate]set_match_is_initialized().(exp_match_is_initialized);
1014
1015 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_enum, exp_enum);
1016 }
1017 }