Debian Codegraph @

src/device.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#};
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::linuxrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/linux/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/linux/fs/::MetadataExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/linux/fs/MetadataExt#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/, envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/, ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/, fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/, timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/};
5
6 use superrust-analyzer cargo udevrs 0.4.0 crate/::{Errorrust-analyzer cargo udevrs 0.4.0 error/Error#, Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#, Resultrust-analyzer cargo udevrs 0.4.0 error/Result#, Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#, 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#};
7 use craterust-analyzer cargo udevrs 0.4.0 crate/::utilrust-analyzer cargo udevrs 0.4.0 util/;
8
9 /// Maximum number of ENVP entries
10 pub const ENVP_LENrust-analyzer cargo udevrs 0.4.0 device/ENVP_LEN.: usize = 128;
11
12 /// Limits the number of characters for a UEVENT file.
13 ///
14 /// **NOTE** 4 KiB limit based on default Linux filesize.
15 pub const UEVENT_FILE_LIMITrust-analyzer cargo udevrs 0.4.0 device/UEVENT_FILE_LIMIT.: usize = 0x1000;
16
17 /// Represents one kernel `sys` device.
18 #[repr(C)]
19 #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
20 pub struct UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice# {
21 udevrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#udev.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>,
22 parent_devicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#parent_device.: 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#<Selfrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#>>,
23 syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
24 devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
25 sysnamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysname.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
26 sysnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysnum.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
27 devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
28 devnode_moderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_mode.: Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#,
29 devnode_uidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_uid.: u32,
30 devnode_gidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_gid.: u32,
31 subsystemrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#subsystem.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
32 devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
33 driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
34 actionrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#action.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
35 devpath_oldrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath_old.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
36 id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
37 envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp.: [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#; ENVP_LENrust-analyzer cargo udevrs 0.4.0 device/ENVP_LEN.],
38 monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
39 devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
40 properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
41 sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
42 sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
43 tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list.: UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#,
44 seqnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#seqnum.: u64,
45 usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized.: u64,
46 devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlink_priority.: i32,
47 devnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnum.: u64,
48 ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex.: i32,
49 watch_handlerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#watch_handle.: i32,
50 majrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#maj.: i32,
51 minrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#min.: i32,
52 devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_uptodate.: bool,
53 envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp_uptodate.: bool,
54 tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_uptodate.: bool,
55 info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded.: bool,
56 db_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_loaded.: bool,
57 uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#uevent_loaded.: bool,
58 is_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#is_initialized.: bool,
59 sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read.: bool,
60 db_persistrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_persist.: bool,
61 }
62
63 impl UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice# {
64 /// Creates a new [UdevDevice].
65 pub fn newrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]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 device/impl#[UdevDevice] {
66 let devlinks_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));
67 let properties_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));
68 let sysattr_value_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));
69 let sysattr_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));
70 let tags_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));
71
72 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
73 udevrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#udev.,
74 parent_devicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#parent_device.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
75 syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#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().(),
76 devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath.: 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().(),
77 sysnamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysname.: 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().(),
78 sysnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysnum.: 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().(),
79 devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode.: 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().(),
80 devnode_moderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_mode.: Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#::newrust-analyzer cargo udevrs 0.4.0 mode/impl#[Mode]new().(),
81 devnode_gidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_gid.: 0,
82 devnode_uidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_uid.: 0,
83 subsystemrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#subsystem.: 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().(),
84 devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype.: 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().(),
85 driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver.: 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().(),
86 actionrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#action.: 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().(),
87 devpath_oldrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath_old.: 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().(),
88 id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename.: 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().(),
89 envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp.: [""; ENVP_LENrust-analyzer cargo udevrs 0.4.0 device/ENVP_LEN.].maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().),
90 monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf.: 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().(),
91 devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list.,
92 properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list.,
93 sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list.,
94 sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list.,
95 tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list.,
96 seqnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#seqnum.: 0,
97 usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized.: 0,
98 devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlink_priority.: 0,
99 devnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnum.: 0,
100 ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex.: 0,
101 watch_handlerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#watch_handle.: 0,
102 majrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#maj.: 0,
103 minrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#min.: 0,
104 devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_uptodate.: false,
105 envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp_uptodate.: false,
106 tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_uptodate.: false,
107 info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded.: false,
108 db_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_loaded.: false,
109 uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#uevent_loaded.: false,
110 is_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#is_initialized.: false,
111 sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read.: false,
112 db_persistrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_persist.: false,
113 }
114 }
115
116 /// Gets a reference to the [Udev] context.
117 pub fn udevrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]udev().(&self) -> &Udevrust-analyzer cargo udevrs 0.4.0 context/Udev# {
118 self.udevrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#udev..as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][`AsRef<T>`]as_ref().()
119 }
120
121 /// Gets a cloned reference to the [Udev] context.
122 pub fn udev_clonedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]udev_cloned().(&self) -> Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#> {
123 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 device/UdevDevice#udev.)
124 }
125
126 /// Creates a new [UdevDevice].
127 pub fn new_from_nulstrrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_nulstr().(udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>, buf: &[u8]) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
128 let mut device = Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::newrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new().(udev);
129
130 device.set_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_info_loaded().(true);
131
132 for key in buf.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split().(|&b| b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0) {
133 if key.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
134 break;
135 }
136
137 device.add_property_from_stringrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(key).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(""));
138 }
139
140 device.add_property_from_string_parse_finishrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string_parse_finish().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
141
142 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(device)
143 }
144
145 /// Creates new [UdevDevice], and fills in information from the sys
146 /// device and the udev database entry.
147 ///
148 /// The `syspath` is the absolute path to the device, including the sys mount point.
149 ///
150 /// The initial refcount is 1, and needs to be decremented to release the resources of the udev device.
151 ///
152 /// Returns: a new [UdevDevice], or `Error`, if it does not exist
153 pub fn new_from_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_syspath().(udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>, syspath: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
154 if syspath.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
155 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#("empty syspath".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
156 } else if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().syspath.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("/sys") {
157 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("not in sys: {syspath}")))
158 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) = syspath.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("/sys/") {
159 let fullpath = if path.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("/devices/") {
160 let uevent_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{syspath}/uevent");
161 let _ = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(uevent_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| {
162 Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to open syspath uevent file: {err}"))
163 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
164 uevent_path
165 } else {
166 syspath.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
167 };
168
169 let dev = Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::newrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new().(udev).with_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_syspath().(fullpath);
170 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("device {dev} has devpath: {}", dev.devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().());
171
172 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev)
173 } else {
174 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#("empty syspath subdir".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
175 }
176 }
177
178 /// Creates new [UdevDevice].
179 ///
180 /// From the `libudev` documentation:
181 ///
182 /// ```no_build,no_run
183 /// Fills in information from the `sys` device and the udev database entry.
184 ///
185 /// The device is looked-up by its major/minor number and type. Character and block device
186 /// numbers are not unique across the two types.
187 /// ```
188 ///
189 /// Parameters:
190 ///
191 /// - `udev`: [Udev] library context
192 /// - `type`: `char` or `block` device
193 /// - `devnum`: device major/minor number
194 ///
195 /// Returns: a new [UdevDevice], or `Err`, if it does not exist
196 pub fn new_from_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_devnum().(udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>, devtype: &str, devnum: libcrust-analyzer cargo libc 0.2.169 crate/::dev_trust-analyzer cargo libc 0.2.169 unix/linux_like/linux/dev_t#) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
197 let type_str = match devtype {
198 t if t.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('b') => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("block"),
199 t if t.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('c') => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("char"),
200 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid device type: {devtype}"))),
201 }?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
202
203 // use /sys/dev/{block,char}/<maj>:<min> link
204 let path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
205 "/sys/dev/{type_str}/{}:{}",
206 utilrust-analyzer cargo udevrs 0.4.0 util/::majorrust-analyzer cargo udevrs 0.4.0 util/major().(devnum),
207 utilrust-analyzer cargo udevrs 0.4.0 util/::minorrust-analyzer cargo udevrs 0.4.0 util/minor().(devnum)
208 );
209 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::new_from_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_syspath().(udev, &path)
210 }
211
212 /// Creates a new [UdevDevice] from the subsystem and sysname.
213 ///
214 /// From the `libudev` documentation:
215 ///
216 /// ```no_build,no_run
217 /// Fills in information from the sys device and the udev database entry.
218 ///
219 /// The device is looked up by the subsystem and name string of the device, like "mem" / "zero", or "block" / "sda".
220 /// ```
221 ///
222 /// Parameters:
223 ///
224 /// - `udev`: [Udev] library context
225 /// - `subsystem`: the subsystem of the device
226 /// - `sysname`: the name of the device
227 ///
228 /// Returns: a new [UdevDevice], or `Err`, if it does not exist
229 pub fn new_from_subsystem_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_subsystem_sysname().(
230 udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>,
231 subsystem: &str,
232 sysname: &str,
233 ) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
234 let path = if subsystem 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" {
235 let sub_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/subsystem/{sysname}");
236 let bus_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/bus/{sysname}");
237 let class_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/class/{sysname}");
238
239 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().(sub_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
240 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(sub_path)
241 } else 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().(bus_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
242 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bus_path)
243 } else 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().(class_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
244 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(class_path)
245 } else {
246 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
247 "no subsystem device found for: {sysname}"
248 )))
249 }
250 } else if subsystem 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()."module" {
251 let path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/module/{sysname}");
252 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().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
253 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(path)
254 } else {
255 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
256 "no module device found for: {sysname}"
257 )))
258 }
259 } else if subsystem 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()."drivers" {
260 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(driver) = sysname.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(':').nthrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#nth().(2) {
261 let sub_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/subsystem/{sysname}/drivers/{driver}");
262 let bus_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/bus/{sysname}/drivers/{driver}");
263
264 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().(sub_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
265 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(sub_path)
266 } else 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().(bus_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
267 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bus_path)
268 } else {
269 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
270 "no driver device found for: {sysname}"
271 )))
272 }
273 } else {
274 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
275 "invalid driver subsystem: {sysname}"
276 )))
277 }
278 } else {
279 let sub_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/subsystem/{subsystem}/devices/{sysname}");
280 let bus_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/bus/{subsystem}/devices/{sysname}");
281 let class_path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/sys/class/{subsystem}/{sysname}");
282
283 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().(sub_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
284 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(sub_path)
285 } else 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().(bus_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
286 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bus_path)
287 } else 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().(class_path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
288 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(class_path)
289 } else {
290 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("no device found for: {sysname}")))
291 }
292 }?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
293
294 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::new_from_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_syspath().(udev, &path)
295 }
296
297 /// Create new [UdevDevice] from an ID string.
298 ///
299 /// From the `libudev` documentation:
300 ///
301 /// ```no_build,no_run
302 ///
303 /// Fill in information from the sys device and the udev database entry.
304 ///
305 /// The device is looked-up by a special string:
306 ///
307 /// b8:2 - block device major:minor
308 /// c128:1 - char device major:minor
309 /// n3 - network device ifindex
310 /// +sound:card29 - kernel driver core subsystem:device name
311 /// ```
312 ///
313 /// Parameters:
314 ///
315 /// - `udev`: udev library context
316 /// - `id`: text string identifying a kernel device
317 ///
318 /// Returns: a new [UdevDevice], or `Err`, if it does not exist
319 pub fn new_from_device_idrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_device_id().(udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>, id: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
320 match id.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().() {
321 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('b') | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('c') => {
322 let devtype = &id[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
323
324 let mut maj_min_iter = id[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(':');
325 let maj = maj_min_iter
326 .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().()
327 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("")
328 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>()
329 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0);
330 let min = maj_min_iter
331 .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().()
332 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("")
333 .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>()
334 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0);
335
336 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::new_from_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_devnum().(udev, devtype, libcrust-analyzer cargo libc 0.2.169 crate/::makedevrust-analyzer cargo libc 0.2.169 unix/linux_like/linux/makedev().(maj, min))
337 }
338 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('n') => {
339 let ifindex = id[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| {
340 Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid network device ID: {id}, error: {err}"))
341 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
342 // SAFETY: all arguments are valid, and properly initialized.
343 let sock = unsafe { libcrust-analyzer cargo libc 0.2.169 crate/::socketrust-analyzer cargo libc 0.2.169 socket().(libcrust-analyzer cargo libc 0.2.169 crate/::PF_INETrust-analyzer cargo libc 0.2.169 unix/linux_like/PF_INET., libcrust-analyzer cargo libc 0.2.169 crate/::SOCK_DGRAMrust-analyzer cargo libc 0.2.169 unix/linux_like/linux/gnu/b64/x86_64/SOCK_DGRAM., 0) };
344 if sock rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().0 {
345 let errno = iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::last_os_errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]last_os_error().();
346 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
347 "unable to create a socket: {errno}"
348 )));
349 }
350
351 // SAFETY: zeroed memory initializes `libc::ifreq` to a valid state.
352 let mut ifr: libcrust-analyzer cargo libc 0.2.169 crate/::ifreqrust-analyzer cargo libc 0.2.169 unix/linux_like/linux/ifreq# = unsafe { memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().() };
353 ifr.ifr_ifrurust-analyzer cargo libc 0.2.169 unix/linux_like/linux/ifreq#ifr_ifru..ifru_ifindexrust-analyzer cargo libc 0.2.169 unix/linux_like/linux/__c_anonymous_ifr_ifru#ifru_ifindex. = ifindex;
354 // SAFETY: all arguments are valid, pointers reference valid memory, and `SICGIFNAME` is a valid ioctl
355 if unsafe { libcrust-analyzer cargo libc 0.2.169 crate/::ioctlrust-analyzer cargo libc 0.2.169 ioctl().(sock, libcrust-analyzer cargo libc 0.2.169 crate/::SIOCGIFNAMErust-analyzer cargo libc 0.2.169 unix/linux_like/linux/SIOCGIFNAME., &mut ifr) } rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 {
356 let errno = iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::last_os_errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]last_os_error().();
357 // SAFETY: `sock` is a valid socket file descriptor returned by the kernel
358 unsafe { libcrust-analyzer cargo libc 0.2.169 crate/::closerust-analyzer cargo libc 0.2.169 close().(sock) };
359 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
360 "invalid interface name: {errno}"
361 )));
362 }
363 // SAFETY: `sock` is a valid socket file descriptor returned by the kernel
364 unsafe { libcrust-analyzer cargo libc 0.2.169 crate/::closerust-analyzer cargo libc 0.2.169 close().(sock) };
365
366 // SAFETY: `ifr_name` is a C-string returned by the kernel.
367 // Unless something went horribly wrong, it will be a valid, nul-terminated C-string.
368 let cifr_name = unsafe { ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_ptr().(ifr.ifr_namerust-analyzer cargo libc 0.2.169 unix/linux_like/linux/ifreq#ifr_name..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().()) };
369 let ifr_name = cifr_name.to_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]to_str().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| {
370 Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to convert ifr_name to Rust string: {err}"))
371 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
372
373 let mut dev = Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::new_from_subsystem_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_subsystem_sysname().(udev, "net", ifr_name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
374 if 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][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().ifindex {
375 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev)
376 } else {
377 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(
378 "unable to create device from ID string".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
379 ))
380 }
381 }
382 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('+') => {
383 let mut subsys_iter = id[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(':');
384 let subsys = subsys_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().().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#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
385 "invalid subsystem from ID: {id}"
386 )))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
387 let sysname = subsys_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().().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#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
388 "invalid system name from ID: {id}"
389 )))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
390
391 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::new_from_subsystem_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_subsystem_sysname().(udev, subsys, sysname)
392 }
393 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid device ID: {id}"))),
394 }
395 }
396
397 /// Create new udev device from the environment information.
398 ///
399 /// From the original `libudev` documnentation:
400 ///
401 /// ```no_build,no_run
402 /// Fills in information from the current process environment.
403 /// This only works reliable if the process is called from a udev rule.
404 /// It is usually used for tools executed from IMPORT= rules.
405 /// ```
406 ///
407 /// Parameters:
408 ///
409 /// - `udev`: [Udev] library context
410 ///
411 /// Returns: a new [UdevDevice], or `Err`, if it does not exist
412 pub fn new_from_environmentrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_environment().(udev: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#>) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
413 let mut dev = Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::newrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new().(udev);
414 dev.set_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_info_loaded().(true);
415
416 for (key, value) in envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::varsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/vars().() {
417 dev.add_property_from_string_parserust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string_parse().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{key}={value}").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().;
418 }
419
420 dev.add_property_from_string_parse_finishrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string_parse_finish().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
421
422 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev)
423 }
424
425 /// Creates a new [UdevDevice] from the next parent directory in the syspath.
426 ///
427 /// Returns an `Err` if no parent is found.
428 pub fn new_from_parentrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_parent().(&self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]> {
429 let path = self.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().();
430 let subdir = path
431 .strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("/sys/")
432 .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#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid syspath: {path}")))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
433
434 let mut pos = subdir.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().();
435 let syslen = "/sys/".lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().();
436 loop {
437 // do a reverse search for the next parent directory on the syspath
438 pos = subdir[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
439 .rfindrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]rfind().('/')
440 .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#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#("no syspath subdirectory".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
441 if pos 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().2 {
442 break;
443 }
444 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev) =
445 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::new_from_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_syspath().(self.udev_clonedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]udev_cloned().(), &path[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#syslen.saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(pos)]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)
446 {
447 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev);
448 }
449 }
450
451 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
452 "no parent device found for syspath: {path}"
453 )))
454 }
455
456 /// Gets the next parent [UdevDevice].
457 ///
458 /// From the `libudev` documentation:
459 ///
460 /// ```no_build,no_run
461 /// Find the next parent device, and fill in information from the sys
462 /// device and the udev database entry.
463 ///
464 /// @udev_device: the device to start searching from
465 ///
466 /// Returned device is not referenced. It is attached to the child
467 /// device, and will be cleaned up when the child device is cleaned up.
468 ///
469 /// It is not necessarily just the upper level directory, empty or not
470 /// recognized sys directories are ignored.
471 ///
472 /// It can be called as many times as needed, without caring about
473 /// references.
474 /// ```
475 ///
476 /// Returns: a new [UdevDevice], or `Err`, if it no parent exists.
477 pub fn get_parentrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_parent().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]>> {
478 match self.parent_devicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#parent_device..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() {
479 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dev) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(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().(dev)),
480 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
481 let dev = 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().(self.new_from_parentrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_parent().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().);
482 self.parent_devicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#parent_device. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(&dev));
483 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev)
484 }
485 }
486 }
487
488 /// Gets the next parent [UdevDevice] based on `subsystem` and `devtype`.
489 ///
490 /// From the `libudev` documentation:
491 ///
492 /// ```no_build,no_run
493 /// Find the next parent device, with a matching subsystem and devtype
494 /// value, and fill in information from the sys device and the udev
495 /// database entry.
496 ///
497 /// If devtype is #NULL, only subsystem is checked, and any devtype will
498 /// match.
499 ///
500 /// Returned device is not referenced. It is attached to the child
501 /// device, and will be cleaned up when the child device is cleaned up.
502 ///
503 /// It can be called as many times as needed, without caring about
504 /// references.
505 /// ```
506 ///
507 /// Parameters:
508 ///
509 /// - `udev_device`: udev device to start searching from
510 /// - `subsystem`: the subsystem of the device
511 /// - `devtype`: the type (DEVTYPE) of the device
512 ///
513 /// Returns: a new [UdevDevice], or `Err` if no matching parent exists.
514 pub fn get_parent_with_subsystem_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_parent_with_subsystem_devtype().(
515 &mut self,
516 subsystem: &str,
517 devtype: &str,
518 ) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]>> {
519 let mut ret = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#("no matching parent device found".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()));
520 let mut parent_res = self.new_from_parentrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_parent().();
521
522 while let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mut parent) = parent_res {
523 let parent_subsystem = parent.get_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_subsystem().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().();
524 let parent_devtype = parent.get_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_devtype().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().();
525
526 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parent_subsystem.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().()
527 && parent_subsystem.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 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
528 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parent_devtype.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().()
529 && parent_devtype.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 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().devtype
530 {
531 let dev = 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().(parent);
532 self.parent_devicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#parent_device. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(&dev));
533
534 // not a real error, but breaks the while loop next iteration
535 parent_res = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#("set parent device".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()));
536 // set a successful return value
537 ret = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dev);
538 } else {
539 // try the next parent device
540 parent_res = parent.new_from_parentrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new_from_parent().();
541 }
542 }
543
544 ret
545 }
546
547 /// Gets whether a parent [UdevDevice] is set.
548 pub const fn parent_setrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]parent_set().(&self) -> bool {
549 self.parent_devicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#parent_device..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
550 }
551
552 /// Gets the [UdevDevice] syspath.
553 pub fn syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().(&self) -> &str {
554 self.syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
555 }
556
557 /// Sets the [UdevDevice] syspath.
558 pub fn set_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_syspath().<P: 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: P) {
559 self.syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath. = syspath.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
560 }
561
562 /// Builder function that sets the [UdevDevice] syspath.
563 pub fn with_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_syspath().<P: 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: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
564 self.set_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_syspath().(syspath);
565 self
566 }
567
568 /// Gets the [UdevDevice] devpath.
569 pub fn devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().(&self) -> &str {
570 self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
571 }
572
573 /// Sets the [UdevDevice] devpath.
574 pub fn set_devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath().<P: 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, devpath: P) {
575 self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath. = devpath.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
576 }
577
578 /// Builder function that sets the [UdevDevice] devpath.
579 pub fn with_devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devpath().<P: 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, devpath: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
580 self.set_devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath().(devpath);
581 self
582 }
583
584 /// Gets the [UdevDevice] sysname.
585 pub fn sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysname().(&self) -> &str {
586 self.sysnamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysname..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
587 }
588
589 /// Sets the [UdevDevice] sysname.
590 pub fn set_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysname().<P: 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, sysname: P) {
591 self.sysnamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysname. = sysname.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
592 }
593
594 /// Builder function that sets the [UdevDevice] sysname.
595 pub fn with_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysname().<P: 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, sysname: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
596 self.set_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysname().(sysname);
597 self
598 }
599
600 /// Gets the [UdevDevice] sysnum.
601 pub fn sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysnum().(&self) -> &str {
602 self.sysnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysnum..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
603 }
604
605 /// Sets the [UdevDevice] sysnum.
606 pub fn set_sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysnum().<P: 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, sysnum: P) {
607 self.sysnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysnum. = sysnum.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
608 }
609
610 /// Builder function that sets the [UdevDevice] sysnum.
611 pub fn with_sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysnum().<P: 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, sysnum: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
612 self.set_sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysnum().(sysnum);
613 self
614 }
615
616 /// Gets the [UdevDevice] devnode.
617 pub fn devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode().(&self) -> &str {
618 self.devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
619 }
620
621 /// Sets the [UdevDevice] devnode.
622 pub fn set_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode().<P: 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, devnode: P) {
623 self.devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode. = devnode.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
624 }
625
626 /// Builder function that sets the [UdevDevice] devnode.
627 pub fn with_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnode().<P: 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, devnode: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
628 self.set_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode().(devnode);
629 self
630 }
631
632 /// Gets the [UdevDevice] `devnode`.
633 ///
634 /// From the `libudev` documentation:
635 ///
636 /// ```no_build,no_run
637 /// Retrieve the device node file name belonging to the udev device.
638 /// The path is an absolute path, and starts with the device directory.
639 /// ```
640 ///
641 /// Returns: the device node file name of the [UdevDevice], or an empty string if none exists.
642 pub fn get_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_devnode().(&mut self) -> &str {
643 if self.devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
644 self.read_uevent_filerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_uevent_file().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
645 }
646 self.devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
647 }
648
649 /// Gets the [UdevDevice] devnode [Mode].
650 pub const fn devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode_mode().(&self) -> Moderust-analyzer cargo udevrs 0.4.0 mode/Mode# {
651 self.devnode_moderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_mode.
652 }
653
654 /// Sets the [UdevDevice] devnode [Mode].
655 pub fn set_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_mode().(&mut self, devnode_mode: Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#) {
656 self.devnode_moderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_mode. = devnode_mode;
657 }
658
659 /// Builder function sets the [UdevDevice] devnode [Mode].
660 pub fn with_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnode_mode().(mut self, devnode_mode: Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
661 self.set_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_mode().(devnode_mode);
662 self
663 }
664
665 /// Gets the [UdevDevice] devnode GID.
666 pub const fn devnode_gidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode_gid().(&self) -> u32 {
667 self.devnode_gidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_gid.
668 }
669
670 /// Sets the [UdevDevice] devnode GID.
671 pub fn set_devnode_gidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_gid().(&mut self, gid: u32) {
672 self.devnode_gidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_gid. = gid;
673 }
674
675 /// Builder function that sets the [UdevDevice] devnode GID.
676 pub fn with_devnode_gidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnode_gid().(mut self, gid: u32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
677 self.set_devnode_gidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_gid().(gid);
678 self
679 }
680
681 /// Gets the [UdevDevice] devnode UID.
682 pub const fn devnode_uidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode_uid().(&self) -> u32 {
683 self.devnode_uidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_uid.
684 }
685
686 /// Sets the [UdevDevice] devnode UID.
687 pub fn set_devnode_uidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_uid().(&mut self, uid: u32) {
688 self.devnode_uidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_uid. = uid;
689 }
690
691 /// Builder function that sets the [UdevDevice] devnode UID.
692 pub fn with_devnode_uidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnode_uid().(mut self, uid: u32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
693 self.set_devnode_uidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_uid().(uid);
694 self
695 }
696
697 /// Gets the [UdevDevice] subsystem.
698 pub fn subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]subsystem().(&self) -> &str {
699 self.subsystemrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#subsystem..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
700 }
701
702 /// Sets the [UdevDevice] subsystem.
703 pub fn set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().<P: 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, subsystem: P) {
704 self.subsystemrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#subsystem. = subsystem.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
705 }
706
707 /// Builder function that sets the [UdevDevice] subsystem.
708 pub fn with_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_subsystem().<P: 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, subsystem: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
709 self.set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().(subsystem);
710 self
711 }
712
713 /// Retrieves the subsystem string of the `udev` device.
714 ///
715 /// The string does not contain any "`/`".
716 ///
717 /// Returns:
718 ///
719 /// - name of the subsystem of the `udev` device.
720 /// - empty string if the subsystem can not be determined.
721 pub fn get_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_subsystem().(&mut self) -> &str {
722 if self.subsystemrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#subsystem..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
723 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(subsystem) = Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::get_sys_core_link_valuerust-analyzer cargo udevrs 0.4.0 util/impl#[Udev]get_sys_core_link_value().("subsystem", self.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().()) {
724 self.set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().(subsystem);
725 } else if self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("/module/")
726 || self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..rfindrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]rfind().("/drivers/").is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
727 {
728 self.set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().("module");
729 } else if self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("/subsystem/")
730 || self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("/class/")
731 || self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("/bus/")
732 {
733 self.set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().("subsystem");
734 }
735 }
736
737 self.subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]subsystem().()
738 }
739
740 /// Gets the [UdevDevice] devtype.
741 pub fn devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devtype().(&self) -> &str {
742 self.devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
743 }
744
745 /// Sets the [UdevDevice] devtype.
746 pub fn set_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devtype().<P: 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, devtype: P) {
747 self.devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype. = devtype.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
748 }
749
750 /// Builder function that sets the [UdevDevice] devtype.
751 pub fn with_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devtype().<P: 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, devtype: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
752 self.set_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devtype().(devtype);
753 self
754 }
755
756 /// Gets the devtypes string of the [UdevDevice].
757 ///
758 /// If the devtype is unset, attempts to read properties from the syspath file.
759 pub fn get_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_devtype().(&mut self) -> &str {
760 if self.devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
761 self.read_uevent_filerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_uevent_file().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
762 }
763 self.devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
764 }
765
766 /// Gets the [UdevDevice] driver.
767 pub fn driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]driver().(&self) -> &str {
768 self.driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
769 }
770
771 /// Sets the [UdevDevice] driver.
772 pub fn set_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_driver().<P: 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, driver: P) {
773 self.driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver. = driver.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
774 }
775
776 /// Builder function that sets the [UdevDevice] driver.
777 pub fn with_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_driver().<P: 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, driver: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
778 self.set_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_driver().(driver);
779 self
780 }
781
782 /// Gets the kernel driver name.
783 ///
784 /// Returns: the kernel driver name, or `None` if none is attached.
785 pub fn get_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_driver().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
786 if self.driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
787 self.driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver. = Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::get_sys_core_link_valuerust-analyzer cargo udevrs 0.4.0 util/impl#[Udev]get_sys_core_link_value().("driver", self.syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
788 }
789 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
790 }
791
792 /// Gets the [UdevDevice] action.
793 pub fn actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]action().(&self) -> &str {
794 self.actionrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#action..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
795 }
796
797 /// Sets the [UdevDevice] action.
798 pub fn set_actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_action().<P: 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, action: P) {
799 self.actionrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#action. = action.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
800 }
801
802 /// Builder function that sets the [UdevDevice] action.
803 pub fn with_actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_action().<P: 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, action: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
804 self.set_actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_action().(action);
805 self
806 }
807
808 /// Gets the [UdevDevice] devpath_old.
809 pub fn devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath_old().(&self) -> &str {
810 self.devpath_oldrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath_old..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
811 }
812
813 /// Sets the [UdevDevice] devpath_old.
814 pub fn set_devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath_old().<P: 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, devpath_old: P) {
815 self.devpath_oldrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath_old. = devpath_old.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
816 }
817
818 /// Builder function that sets the [UdevDevice] devpath_old.
819 pub fn with_devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devpath_old().<P: 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, devpath_old: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
820 self.set_devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath_old().(devpath_old);
821 self
822 }
823
824 /// Gets the [UdevDevice] id_filename.
825 pub fn id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]id_filename().(&self) -> &str {
826 self.id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
827 }
828
829 /// Sets the [UdevDevice] id_filename.
830 pub fn set_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_id_filename().<P: 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, id_filename: P) {
831 self.id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename. = id_filename.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
832 }
833
834 /// Builder function that sets the [UdevDevice] id_filename.
835 pub fn with_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_id_filename().<P: 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, id_filename: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
836 self.set_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_id_filename().(id_filename);
837 self
838 }
839
840 /// Gets the ID filename.
841 ///
842 /// If the filename is empty, attempts to set it based on subsystem information.
843 ///
844 /// Returns: the ID filename, or an empty string if none can be constructed.
845 pub fn get_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_id_filename().(&mut self) -> &str {
846 let id_filename = if self.id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
847 if self.get_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_subsystem().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
848 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().()
849 } else if utilrust-analyzer cargo udevrs 0.4.0 util/::majorrust-analyzer cargo udevrs 0.4.0 util/major().(self.get_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_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 {
850 // From `libudev` documentation:
851 //
852 // use devtype: <type><major>:<minor>, e.g. b259:131072, c254:0
853 let devtype = if self.get_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_subsystem().() 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()."block" {
854 'b'
855 } else {
856 'c'
857 };
858 let devnum = self.devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnum().();
859 let major = utilrust-analyzer cargo udevrs 0.4.0 util/::majorrust-analyzer cargo udevrs 0.4.0 util/major().(devnum);
860 let minor = utilrust-analyzer cargo udevrs 0.4.0 util/::minorrust-analyzer cargo udevrs 0.4.0 util/minor().(devnum);
861 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{devtype}{major}:{minor}")
862 } else if self.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 {
863 // From `libudev` documentation:
864 //
865 // use netdev ifindex: <type><ifindex>, e.g. n3
866 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("n{}", self.ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex.)
867 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(sysname) = self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().().rsplitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]rsplit().('/').nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`RSplit<'a, P>`][Iterator]next().() {
868 // From `libudev` documentation:
869 //
870 // use $subsys:$sysname, e.g. pci:0000:00:1f.2
871 // sysname() has '!' translated, get it from devpath
872 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("+{}:{sysname}", self.get_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_subsystem().())
873 } else {
874 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().()
875 }
876 } else {
877 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().()
878 };
879
880 if id_filename.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
881 ""
882 } else {
883 self.id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename. = id_filename;
884 self.id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]id_filename().()
885 }
886 }
887
888 /// Gets a reference to the list of `envp` arguments.
889 pub fn envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp().(&self) -> &[Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#] {
890 let len = self.envp_lenrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_len().();
891 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[`[T]`][`AsRef<Self>`]as_ref().()
892 }
893
894 /// Gets the length of non-empty `envp` arguments.
895 pub fn envp_lenrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_len().(&self) -> usize {
896 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().take_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take_while().(|e| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().e.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().()).countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().()
897 }
898
899 /// Sets the list of `envp` arguments.
900 pub fn set_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp().<P: 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#> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#>(&mut self, envp: &[P]) {
901 let len = cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(envp.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), ENVP_LENrust-analyzer cargo udevrs 0.4.0 device/ENVP_LEN.);
902 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().
903 .iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().()
904 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(envp.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().())
905 .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(dst, src)| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().dst = src.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().());
906 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().len..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]for_each().(|s| s.clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]clear().());
907 }
908
909 /// Builder function that sets the list of `envp` arguments.
910 pub fn with_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_envp().<P: 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#> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#>(mut self, envp: &[P]) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
911 self.set_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp().(envp);
912 self
913 }
914
915 /// Gets whether the `envp` list is empty.
916 pub fn envp_is_emptyrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_is_empty().(&self) -> bool {
917 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|e| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().e.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().()).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
918 }
919
920 /// Clears the `envp` arguments.
921 pub fn clear_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]clear_envp().(&mut self) {
922 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]for_each().(|s| s.clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]clear().());
923 }
924
925 /// Gets the [UdevDevice] monitor_buf.
926 pub fn monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]monitor_buf().(&self) -> &str {
927 self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
928 }
929
930 /// Sets the [UdevDevice] monitor_buf.
931 pub fn set_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_monitor_buf().<P: 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, monitor_buf: P) {
932 self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf. = monitor_buf.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
933 }
934
935 /// Builder function that sets the [UdevDevice] monitor_buf.
936 pub fn with_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_monitor_buf().<P: 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, monitor_buf: P) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
937 self.set_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_monitor_buf().(monitor_buf);
938 self
939 }
940
941 /// Gets the environment properties monitor buffer.
942 ///
943 /// If the environment is not up to date, updates the monitor buffer.
944 pub fn get_properties_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_properties_monitor_buf().(&mut self) -> &str {
945 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp_uptodate. {
946 self.update_envp_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]update_envp_monitor_buf().();
947 }
948 self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]monitor_buf().()
949 }
950
951 /// Updates the `envp` and monitor buffer from the properties list.
952 pub fn update_envp_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]update_envp_monitor_buf().(&mut self) {
953 self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]clear().();
954 self.clear_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]clear_envp().();
955
956 // add at most `ENVP_LEN` properties, skipping private entries
957 for (i, list_entry) in self
958 .properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list.
959 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
960 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|e| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().e.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().().starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('.'))
961 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
962 .takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(ENVP_LENrust-analyzer cargo udevrs 0.4.0 device/ENVP_LEN.)
963 {
964 let key = list_entry.namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]name().();
965 let value = list_entry.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().();
966
967 // add string to envp
968 let envp_str = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{key}={value}");
969
970 self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign().+=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign().envp_str.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().();
971 self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign().+=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign()."\0";
972
973 self.envprust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = envp_str;
974 }
975
976 self.set_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp_uptodate().(true);
977 }
978
979 /// Gets a reference to the [UdevDevice] `devlinks_list` [UdevList].
980 pub const fn devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
981 &self.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list.
982 }
983
984 /// Gets a mutable reference to the [UdevDevice] `devlinks_list` [UdevList].
985 pub fn devlinks_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
986 &mut self.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list.
987 }
988
989 /// Gets the next entry in the `devlinks` list.
990 pub fn devlinks_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_list_entry().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
991 self.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list..next_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]next_entry().()
992 }
993
994 /// Gets the list of device links for the [UdevDevice].
995 ///
996 /// From the `libudev` documentation:
997 ///
998 /// ```no_build,no_run
999 /// Retrieve the list of device links pointing to the device file of
1000 /// the udev device. The next list entry can be retrieved with
1001 /// udev_list_entry_get_next(), which returns #NULL if no more entries exist.
1002 ///
1003 /// The devlink path can be retrieved from the list entry by
1004 /// udev_list_entry_get_name(). The path is an absolute path, and starts with
1005 /// the device directory.
1006 /// ```
1007 ///
1008 /// Returns: the first entry of the device node link list
1009 pub fn get_devlinks_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_devlinks_list_entry().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1010 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1011 self.read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
1012 }
1013 self.devlinks_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_list_entry().()
1014 }
1015
1016 /// Sets the [UdevDevice] `devlinks_list` [UdevList].
1017 pub fn set_devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_list().<U: 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, devlinks_list: U) {
1018 self.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(devlinks_list);
1019 }
1020
1021 /// Builder function sets the [UdevDevice] [UdevList].
1022 pub fn with_devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devlinks_list().<U: 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, devlinks_list: U) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1023 self.set_devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_list().(devlinks_list);
1024 self
1025 }
1026
1027 /// Adds an [UdevEntry] to the devlinks list.
1028 pub fn add_devlinkrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_devlink().(&mut self, devlink: &str) {
1029 self.set_devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_uptodate().(false);
1030 self.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_list..add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(devlink, "");
1031 }
1032
1033 /// Gets a reference to the [UdevDevice] `properties_list` [UdevList].
1034 pub const fn properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]properties_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1035 &self.properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list.
1036 }
1037
1038 /// Gets a mutable reference to the [UdevDevice] `properties_list` [UdevList].
1039 pub fn properties_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]properties_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1040 &mut self.properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list.
1041 }
1042
1043 /// Sets the [UdevDevice] `properties_list` [UdevList].
1044 pub fn set_properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_properties_list().<U: 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, properties_list: U) {
1045 self.properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(properties_list);
1046 }
1047
1048 /// Builder function sets the [UdevDevice] [UdevList].
1049 pub fn with_properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_properties_list().<U: 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, properties_list: U) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1050 self.set_properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_properties_list().(properties_list);
1051 self
1052 }
1053
1054 /// Gets the value of a given property.
1055 pub fn get_property_valuerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_property_value().(&self, key: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> {
1056 self.properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list..entry_by_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]entry_by_name().(key).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|e| e.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().())
1057 }
1058
1059 /// Gets a reference to the [UdevDevice] `sysattr_value_list` [UdevList].
1060 pub const fn sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_value_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1061 &self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list.
1062 }
1063
1064 /// Gets a mutable reference to the [UdevDevice] `sysattr_value_list` [UdevList].
1065 pub fn sysattr_value_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_value_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1066 &mut self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list.
1067 }
1068
1069 /// Sets the [UdevDevice] `sysattr_value_list` [UdevList].
1070 pub fn set_sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_value_list().<U: 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, sysattr_value_list: U) {
1071 self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(sysattr_value_list);
1072 }
1073
1074 /// Builder function sets the [UdevDevice] [UdevList].
1075 pub fn with_sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysattr_value_list().<U: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(
1076 mut self,
1077 sysattr_value_list: U,
1078 ) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1079 self.set_sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_value_list().(sysattr_value_list);
1080 self
1081 }
1082
1083 /// Gets a reference to the [UdevDevice] `sysattr_list` [UdevList].
1084 pub const fn sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1085 &self.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list.
1086 }
1087
1088 /// Gets a mutable reference to the [UdevDevice] `sysattr_list` [UdevList].
1089 pub fn sysattr_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1090 &mut self.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list.
1091 }
1092
1093 /// Sets the [UdevDevice] `sysattr_list` [UdevList].
1094 pub fn set_sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_list().<U: 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, sysattr_list: U) {
1095 self.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(sysattr_list);
1096 }
1097
1098 /// Builder function sets the [UdevDevice] [UdevList].
1099 pub fn with_sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysattr_list().<U: 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, sysattr_list: U) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1100 self.set_sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_list().(sysattr_list);
1101 self
1102 }
1103
1104 /// Gets the first entry in the `sysattr` properties list.
1105 ///
1106 /// From the `libudev` documentation:
1107 ///
1108 /// ```no_build,no_run
1109 /// Retrieve the list of available sysattrs, with value being empty;
1110 /// This just return all available sysfs attributes for a particular
1111 /// device without reading their values.
1112 /// ```
1113 ///
1114 /// Returns: the first entry of the property list
1115 pub fn get_sysattr_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_sysattr_list_entry().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1116 let num = if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read. {
1117 self.get_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_sysattr_list_read().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().
1118 } else {
1119 0
1120 };
1121 if num rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
1122 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
1123 } else {
1124 self.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list..entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]entry().()
1125 }
1126 }
1127
1128 /// Gets the sys attribute file value.
1129 ///
1130 /// From the `libudev` documentation:
1131 ///
1132 /// ```no_build,no_run
1133 /// The retrieved value is cached in the device. Repeated calls will return the same
1134 /// value and not open the attribute again.
1135 /// ```
1136 ///
1137 /// Returns: the content of a sys attribute file, or `None` if there is no sys attribute value.
1138 pub fn get_sysattr_valuerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_sysattr_value().(&mut self, sysattr: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
1139 match self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list..entry_by_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]entry_by_name().(sysattr).clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]cloned().() {
1140 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()),
1141 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
1142 let path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}/{sysattr}", self.syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath.);
1143 match 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().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) {
1144 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(metadata) => {
1145 if metadata.is_symlinkrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[Metadata]is_symlink().() {
1146 if sysattr 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()."driver" || sysattr 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" || sysattr 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()."module"
1147 {
1148 let value =
1149 Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::get_sys_core_link_valuerust-analyzer cargo udevrs 0.4.0 util/impl#[Udev]get_sys_core_link_value().(sysattr, self.syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
1150 .okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
1151 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(
1152 self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list.
1153 .add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(sysattr, value.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 option/impl#[`Option<T>`][Try]branch().
1154 .valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().()
1155 .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(),
1156 )
1157 } else {
1158 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
1159 }
1160 } else if metadata.is_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[Metadata]is_dir().()
1161 || metadata.lenrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[Metadata]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().0
1162 || metadata.st_moderust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/linux/fs/impl#[Metadata][MetadataExt]st_mode().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().libcrust-analyzer cargo libc 0.2.169 crate/::S_IRUSRrust-analyzer cargo libc 0.2.169 unix/linux_like/S_IRUSR. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().0
1163 {
1164 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
1165 } else {
1166 let mut file = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
1167 let mut value = [0u8; 4096];
1168 let read = file.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File][Read]read().(&mut value).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
1169 let value_str =
1170 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#read]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[`[T]`][`AsRef<Self>`]as_ref().()).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().("");
1171 let entry = self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list..add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(sysattr, value_str)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
1172
1173 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry.valuerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]value().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())
1174 }
1175 }
1176 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => {
1177 self.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_value_list..add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(sysattr, "");
1178 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
1179 }
1180 }
1181 }
1182 }
1183 }
1184
1185 /// Gets a reference to the [UdevDevice] `tags_list` [UdevList].
1186 pub const fn tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_list().(&self) -> &UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1187 &self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list.
1188 }
1189
1190 /// Gets a mutable reference to the [UdevDevice] `tags_list` [UdevList].
1191 pub fn tags_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_list_mut().(&mut self) -> &mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList# {
1192 &mut self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list.
1193 }
1194
1195 /// Sets the [UdevDevice] `tags_list` [UdevList].
1196 pub fn set_tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_list().<U: 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, tags_list: U) {
1197 self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list..set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(tags_list);
1198 }
1199
1200 /// Builder function sets the [UdevDevice] [UdevList].
1201 pub fn with_tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_tags_list().<U: 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, tags_list: U) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1202 self.set_tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_list().(tags_list);
1203 self
1204 }
1205
1206 /// Gets the first tags list entry in the [UdevDevice].
1207 pub fn tags_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_list_entry().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1208 self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list..entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]entry().()
1209 }
1210
1211 /// Gets the first tags list entry in the [UdevDevice].
1212 ///
1213 /// From the `libudev` documentation:
1214 ///
1215 /// ```no_build,no_run
1216 /// Retrieve the list of tags attached to the udev device. The next
1217 /// list entry can be retrieved with udev_list_entry_get_next(),
1218 /// which returns `None` if no more entries exist. The tag string
1219 /// can be retrieved from the list entry by udev_list_entry_get_name().
1220 /// ```
1221 ///
1222 /// Returns: the first entry of the tag list
1223 pub fn get_tags_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_tags_list_entry().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1224 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1225 self.read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1226 }
1227 self.tags_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_list_entry().()
1228 }
1229
1230 /// Gets the current tags list entry in the [UdevDevice].
1231 ///
1232 /// From the `libudev` documentation:
1233 ///
1234 /// ```no_build,no_run
1235 /// Retrieve the list of tags attached to the udev device. The next
1236 /// list entry can be retrieved with udev_list_entry_get_next(),
1237 /// which returns `None` if no more entries exist. The tag string
1238 /// can be retrieved from the list entry by udev_list_entry_get_name().
1239 /// ```
1240 ///
1241 /// Returns: the current entry of the tag list
1242 pub fn get_current_tags_list_entryrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_current_tags_list_entry().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1243 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1244 self.read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1245 }
1246 self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list..next_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]next_entry().()
1247 }
1248
1249 /// Adds an [UdevEntry] to the tags list.
1250 pub fn add_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_tag().(&mut self, tag: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
1251 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]::is_valid_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]is_valid_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1252
1253 self.set_tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_uptodate().(false);
1254 self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list..add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(tag, "");
1255
1256 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1257 }
1258
1259 fn is_valid_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]is_valid_tag().(tag: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
1260 if tag.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(':') || tag.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(' ') {
1261 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::Udevrust-analyzer cargo udevrs 0.4.0 error/Error#Udev#("device: invalid tag".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
1262 } else {
1263 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1264 }
1265 }
1266
1267 /// Gets whether the [UdevDevice] has the provided `tag` associated.
1268 ///
1269 /// From the `libudev` documentation:
1270 ///
1271 /// ```no_build,no_run
1272 /// Check if a given device has a certain tag associated.
1273 /// ```
1274 pub fn has_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]has_tag().(&mut self, tag: &str) -> bool {
1275 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1276 self.read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1277 }
1278 self.tags_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_list..entry_by_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]entry_by_name().(tag).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
1279 }
1280
1281 /// Gets the [UdevDevice] seqnum.
1282 pub const fn seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]seqnum().(&self) -> u64 {
1283 self.seqnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#seqnum.
1284 }
1285
1286 /// Sets the [UdevDevice] seqnum.
1287 pub fn set_seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_seqnum().(&mut self, seqnum: u64) {
1288 self.seqnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#seqnum. = seqnum;
1289 }
1290
1291 /// Builder function sets the [UdevDevice] seqnum.
1292 pub fn with_seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_seqnum().(mut self, seqnum: u64) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1293 self.set_seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_seqnum().(seqnum);
1294 self
1295 }
1296
1297 /// Gets the [UdevDevice] usec_initialized.
1298 pub const fn usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]usec_initialized().(&self) -> u64 {
1299 self.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized.
1300 }
1301
1302 /// Sets the [UdevDevice] usec_initialized.
1303 pub fn set_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_usec_initialized().(&mut self, usec_initialized: u64) {
1304 self.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized. = usec_initialized;
1305 }
1306
1307 /// Builder function sets the [UdevDevice] usec_initialized.
1308 pub fn with_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_usec_initialized().(mut self, usec_initialized: u64) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1309 self.set_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_usec_initialized().(usec_initialized);
1310 self
1311 }
1312
1313 /// Gets the number of microseconds since the [UdevDevice] was initialized.
1314 ///
1315 /// From the `libudev` documentation:
1316 ///
1317 /// ```no_build,no_run
1318 /// Return the number of microseconds passed since udev set up the
1319 /// device for the first time.
1320 ///
1321 /// This is only implemented for devices with need to store properties
1322 /// in the udev database. All other devices return 0 here.
1323 /// ```
1324 ///
1325 /// Returns: the number of microseconds since the device was first seen.
1326 pub fn get_usec_since_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_usec_since_initialized().(&mut self) -> u64 {
1327 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1328 self.read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1329 }
1330 if self.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().0 {
1331 0
1332 } else {
1333 timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]now().()
1334 .duration_sincerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]duration_since().(timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH.)
1335 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_microsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_micros().(self.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized.))
1336 .as_microsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_micros().()
1337 .saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u128]saturating_sub().(self.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized. as u128) as u64
1338 }
1339 }
1340
1341 /// Gets the [UdevDevice] devlink priority.
1342 pub const fn devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlink_priority().(&self) -> i32 {
1343 self.devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlink_priority.
1344 }
1345
1346 /// Sets the [UdevDevice] devlink priority.
1347 pub fn set_devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlink_priority().(&mut self, devlink_priority: i32) {
1348 self.devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlink_priority. = devlink_priority;
1349 }
1350
1351 /// Builder function sets the [UdevDevice] devlink priority.
1352 pub fn with_devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devlink_priority().(mut self, devlink_priority: i32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1353 self.set_devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlink_priority().(devlink_priority);
1354 self
1355 }
1356
1357 /// Gets the [UdevDevice] devnum.
1358 pub const fn devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnum().(&self) -> u64 {
1359 self.devnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnum.
1360 }
1361
1362 /// Sets the [UdevDevice] devnum.
1363 pub fn set_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnum().(&mut self, devnum: u64) {
1364 self.devnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnum. = devnum;
1365 }
1366
1367 /// Builder function sets the [UdevDevice] devnum.
1368 pub fn with_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnum().(mut self, devnum: u64) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1369 self.set_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnum().(devnum);
1370 self
1371 }
1372
1373 /// Gets the device major/minor number.
1374 pub fn get_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_devnum().(&mut self) -> u64 {
1375 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1376 self.read_uevent_filerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_uevent_file().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1377 }
1378 self.devnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnum.
1379 }
1380
1381 /// Gets the [UdevDevice] ifindex.
1382 pub const fn ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]ifindex().(&self) -> i32 {
1383 self.ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex.
1384 }
1385
1386 /// Sets the [UdevDevice] ifindex.
1387 pub fn set_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_ifindex().(&mut self, ifindex: i32) {
1388 self.ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex. = ifindex;
1389 }
1390
1391 /// Builder function sets the [UdevDevice] ifindex.
1392 pub fn with_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_ifindex().(mut self, ifindex: i32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1393 self.set_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_ifindex().(ifindex);
1394 self
1395 }
1396
1397 /// Gets the [UdevDevice] ifindex.
1398 ///
1399 /// If the information file is not loaded, reads and parses the file from disk.
1400 pub fn get_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_ifindex().(&mut self) -> i32 {
1401 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1402 self.read_uevent_filerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_uevent_file().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1403 }
1404 self.ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex.
1405 }
1406
1407 /// Gets the [UdevDevice] watch handle.
1408 pub const fn watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]watch_handle().(&self) -> i32 {
1409 self.watch_handlerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#watch_handle.
1410 }
1411
1412 /// Sets the [UdevDevice] watch handle.
1413 pub fn set_watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_watch_handle().(&mut self, watch_handle: i32) {
1414 self.watch_handlerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#watch_handle. = watch_handle;
1415 }
1416
1417 /// Builder function sets the [UdevDevice] watch handle.
1418 pub fn with_watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_watch_handle().(mut self, watch_handle: i32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1419 self.set_watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_watch_handle().(watch_handle);
1420 self
1421 }
1422
1423 /// Gets the [UdevDevice] major number.
1424 pub const fn majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]maj().(&self) -> i32 {
1425 self.majrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#maj.
1426 }
1427
1428 /// Sets the [UdevDevice] major number.
1429 pub fn set_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_maj().(&mut self, maj: i32) {
1430 self.majrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#maj. = maj;
1431 }
1432
1433 /// Builder function sets the [UdevDevice] major number.
1434 pub fn with_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_maj().(mut self, maj: i32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1435 self.set_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_maj().(maj);
1436 self
1437 }
1438
1439 /// Gets the [UdevDevice] minor number.
1440 pub const fn minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]min().(&self) -> i32 {
1441 self.minrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#min.
1442 }
1443
1444 /// Sets the [UdevDevice] minor number.
1445 pub fn set_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_min().(&mut self, min: i32) {
1446 self.minrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#min. = min;
1447 }
1448
1449 /// Builder function sets the [UdevDevice] minor number.
1450 pub fn with_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_min().(mut self, min: i32) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1451 self.set_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_min().(min);
1452 self
1453 }
1454
1455 /// Gets the [UdevDevice] devlinks up-to-date.
1456 pub const fn devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_uptodate().(&self) -> bool {
1457 self.devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_uptodate.
1458 }
1459
1460 /// Sets the [UdevDevice] devlinks up-to-date.
1461 pub fn set_devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_uptodate().(&mut self, devlinks_uptodate: bool) {
1462 self.devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlinks_uptodate. = devlinks_uptodate;
1463 }
1464
1465 /// Builder function sets the [UdevDevice] devlinks up-to-date.
1466 pub fn with_devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devlinks_uptodate().(mut self, devlinks_uptodate: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1467 self.set_devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_uptodate().(devlinks_uptodate);
1468 self
1469 }
1470
1471 /// Gets the [UdevDevice] envp up-to-date.
1472 pub const fn envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_uptodate().(&self) -> bool {
1473 self.envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp_uptodate.
1474 }
1475
1476 /// Sets the [UdevDevice] envp up-to-date.
1477 pub fn set_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp_uptodate().(&mut self, envp_uptodate: bool) {
1478 self.envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#envp_uptodate. = envp_uptodate;
1479 }
1480
1481 /// Builder function sets the [UdevDevice] envp up-to-date.
1482 pub fn with_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_envp_uptodate().(mut self, envp_uptodate: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1483 self.set_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp_uptodate().(envp_uptodate);
1484 self
1485 }
1486
1487 /// Gets the [UdevDevice] tags up-to-date.
1488 pub const fn tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_uptodate().(&self) -> bool {
1489 self.tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_uptodate.
1490 }
1491
1492 /// Sets the [UdevDevice] tags up-to-date.
1493 pub fn set_tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_uptodate().(&mut self, tags_uptodate: bool) {
1494 self.tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/UdevDevice#tags_uptodate. = tags_uptodate;
1495 }
1496
1497 /// Builder function sets the [UdevDevice] tags up-to-date.
1498 pub fn with_tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_tags_uptodate().(mut self, tags_uptodate: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1499 self.set_tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_uptodate().(tags_uptodate);
1500 self
1501 }
1502
1503 /// Gets the [UdevDevice] info loaded.
1504 pub const fn info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]info_loaded().(&self) -> bool {
1505 self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded.
1506 }
1507
1508 /// Sets the [UdevDevice] info loaded.
1509 pub fn set_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_info_loaded().(&mut self, info_loaded: bool) {
1510 self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. = info_loaded;
1511 }
1512
1513 /// Builder function sets the [UdevDevice] info loaded.
1514 pub fn with_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_info_loaded().(mut self, info_loaded: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1515 self.set_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_info_loaded().(info_loaded);
1516 self
1517 }
1518
1519 /// Gets the [UdevDevice] db loaded.
1520 pub const fn db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_loaded().(&self) -> bool {
1521 self.db_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_loaded.
1522 }
1523
1524 /// Sets the [UdevDevice] db loaded.
1525 pub fn set_db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_db_loaded().(&mut self, db_loaded: bool) {
1526 self.db_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_loaded. = db_loaded;
1527 }
1528
1529 /// Builder function sets the [UdevDevice] db loaded.
1530 pub fn with_db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_db_loaded().(mut self, db_loaded: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1531 self.set_db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_db_loaded().(db_loaded);
1532 self
1533 }
1534
1535 /// Gets the [UdevDevice] uevent loaded.
1536 pub const fn uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]uevent_loaded().(&self) -> bool {
1537 self.uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#uevent_loaded.
1538 }
1539
1540 /// Sets the [UdevDevice] uevent loaded.
1541 pub fn set_uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_uevent_loaded().(&mut self, uevent_loaded: bool) {
1542 self.uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#uevent_loaded. = uevent_loaded;
1543 }
1544
1545 /// Builder function sets the [UdevDevice] uevent loaded.
1546 pub fn with_uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_uevent_loaded().(mut self, uevent_loaded: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1547 self.set_uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_uevent_loaded().(uevent_loaded);
1548 self
1549 }
1550
1551 /// Gets the [UdevDevice] is initialized.
1552 pub const fn is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]is_initialized().(&self) -> bool {
1553 self.is_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#is_initialized.
1554 }
1555
1556 /// Sets the [UdevDevice] is initialized.
1557 pub fn set_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_is_initialized().(&mut self, is_initialized: bool) {
1558 self.is_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#is_initialized. = is_initialized;
1559 }
1560
1561 /// Builder function sets the [UdevDevice] is initialized.
1562 pub fn with_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_is_initialized().(mut self, is_initialized: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1563 self.set_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_is_initialized().(is_initialized);
1564 self
1565 }
1566
1567 /// Gets whether the [UdevDevice] is initialized.
1568 ///
1569 /// From the `libudev` documentation:
1570 ///
1571 /// ```no_build,no_run
1572 /// Check if udev has already handled the device and has set up
1573 /// device node permissions and context, or has renamed a network
1574 /// device.
1575 ///
1576 /// This is only implemented for devices with a device node
1577 /// or network interfaces. All other devices return 1 here.
1578 /// ```
1579 pub fn get_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_is_initialized().(&mut self) -> bool {
1580 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.info_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#info_loaded. {
1581 self.read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().();
1582 }
1583 self.is_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#is_initialized.
1584 }
1585
1586 /// Gets the [UdevDevice] sysattr list read.
1587 pub const fn sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_list_read().(&self) -> bool {
1588 self.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read.
1589 }
1590
1591 /// Sets the [UdevDevice] sysattr list read.
1592 pub fn set_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_list_read().(&mut self, sysattr_list_read: bool) {
1593 self.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read. = sysattr_list_read;
1594 }
1595
1596 /// Builder function sets the [UdevDevice] sysattr list read.
1597 pub fn with_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysattr_list_read().(mut self, sysattr_list_read: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1598 self.set_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_list_read().(sysattr_list_read);
1599 self
1600 }
1601
1602 pub fn get_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_sysattr_list_read().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<usize> {
1603 let mut num = 0usize;
1604 if self.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read. {
1605 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(num)
1606 } else {
1607 let syspath = self.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().();
1608
1609 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().(syspath.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
1610 .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#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to open device syspath: {err}")))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
1611 {
1612 let entry = match dir_entry {
1613 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(e) => e,
1614 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => continue,
1615 };
1616
1617 let file_type = entry.file_typerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_type().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| {
1618 Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to get syspath entry file type: {err}"))
1619 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1620
1621 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().file_type.is_symlinkrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[FileType]is_symlink().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().file_type.is_filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[FileType]is_file().() {
1622 continue;
1623 }
1624
1625 let name = match entry.file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().().into_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_string().() {
1626 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(n) => n,
1627 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => continue,
1628 };
1629
1630 let path = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}/{name}", syspath);
1631 let metadata = match 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().(path.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) {
1632 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(m) => m,
1633 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => continue,
1634 };
1635 if metadata.st_moderust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/linux/fs/impl#[Metadata][MetadataExt]st_mode().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().libcrust-analyzer cargo libc 0.2.169 crate/::S_IRUSRrust-analyzer cargo libc 0.2.169 unix/linux_like/S_IRUSR. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]ne().0 {
1636 continue;
1637 }
1638
1639 self.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list..add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), "");
1640 num = num.saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(1);
1641 }
1642
1643 self.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysattr_list_read. = true;
1644
1645 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(num)
1646 }
1647 }
1648
1649 /// Gets the [UdevDevice] database persist.
1650 pub const fn db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_persist().(&self) -> bool {
1651 self.db_persistrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_persist.
1652 }
1653
1654 /// Sets the [UdevDevice] database persist.
1655 pub fn set_db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_db_persist().(&mut self, db_persist: bool) {
1656 self.db_persistrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#db_persist. = db_persist;
1657 }
1658
1659 /// Builder function sets the [UdevDevice] database persist.
1660 pub fn with_db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_db_persist().(mut self, db_persist: bool) -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice] {
1661 self.set_db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_db_persist().(db_persist);
1662 self
1663 }
1664
1665 /// Reads [UdevDevice] information from the persistent database file.
1666 ///
1667 /// Returns: `Ok(())` on success, `Err(Error)` otherwise
1668 pub fn read_dbrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_db().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
1669 let id = self.get_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]get_id_filename().().to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().();
1670 if self.db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_loaded().() {
1671 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1672 } else if id.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
1673 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#("unable to retrieve ID filename".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
1674 } else {
1675 let filename = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/udev/data/{id}");
1676 let file = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(filename.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| {
1677 Errorrust-analyzer cargo udevrs 0.4.0 error/Error#::UdevDevicerust-analyzer cargo udevrs 0.4.0 error/Error#UdevDevice#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unable to open DB file: {filename}, error: {err}"))
1678 })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1679
1680 // devices with a database entry are initialized
1681 self.is_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#is_initialized. = true;
1682
1683 let mut line = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]with_capacity().(utilrust-analyzer cargo udevrs 0.4.0 util/::LINE_SIZErust-analyzer cargo udevrs 0.4.0 util/LINE_SIZE.);
1684 let mut reader = iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(file);
1685
1686 while let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(len) = reader.read_linerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#read_line().(&mut line) {
1687 if len 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().4 {
1688 break;
1689 }
1690 let val = &line[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().;
1691 match val.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().() {
1692 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('S') => {
1693 self.add_devlinkrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_devlink().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("/dev/{val}").as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().());
1694 break;
1695 }
1696 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('L') => {
1697 self.set_devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlink_priority().(val.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1698 break;
1699 }
1700 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('E') => {
1701 if self.add_property_from_stringrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string().(val).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
1702 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry) = self.properties_listrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#properties_list..list_mutrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]list_mut().().back_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/impl#[`LinkedList<T, A>`]back_mut().() {
1703 entry.set_numrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]set_num().(1);
1704 }
1705 }
1706 break;
1707 }
1708 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('G') => {
1709 self.add_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_tag().(val)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1710 break;
1711 }
1712 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('W') => {
1713 self.set_watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_watch_handle().(val.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1714 break;
1715 }
1716 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('I') => {
1717 self.set_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_usec_initialized().(val.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u64>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1718 break;
1719 }
1720 _ => (),
1721 }
1722 }
1723
1724 logrust-analyzer cargo log 0.4.25 crate/::tracerust-analyzer cargo log 0.4.25 macros/trace!!("device {self} filled with DB file data");
1725
1726 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1727 }
1728 }
1729
1730 /// Reads properties from the `uevent` file.
1731 pub fn read_uevent_filerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]read_uevent_file().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
1732 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#uevent_loaded. {
1733 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1734 } else {
1735 let filename = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}/uevent", self.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().());
1736 let f = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::OpenOptionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/OpenOptions#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]new().().readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]read().(true).openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]open().(filename)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1737
1738 self.uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#uevent_loaded. = true;
1739
1740 let mut reader = iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]new().(f.takerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#take().(UEVENT_FILE_LIMITrust-analyzer cargo udevrs 0.4.0 device/UEVENT_FILE_LIMIT. as u64));
1741 let mut line = 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().();
1742
1743 let (mut maj, mut min) = (0u32, 0u32);
1744
1745 while let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(read) = reader.read_linerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#read_line().(&mut line) {
1746 let tline = line.trim_end_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end_matches().('\n');
1747
1748 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devtype) = tline.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVTYPE=") {
1749 self.set_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devtype().(devtype);
1750 continue;
1751 }
1752 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ifindex) = tline.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("IFINDEX=") {
1753 self.set_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_ifindex().(ifindex.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1754 continue;
1755 }
1756 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devname) = tline.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVNAME=") {
1757 self.set_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode().(devname);
1758 continue;
1759 }
1760
1761 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(major) = tline.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("MAJOR=") {
1762 maj = major.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0);
1763 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(minor) = tline.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("MINOR=") {
1764 min = minor.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0);
1765 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devmode) = tline.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVMODE=") {
1766 self.set_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_mode().(u32::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_str_radix().(devmode, 8).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
1767 }
1768
1769 self.add_property_from_stringrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string().(tline);
1770
1771 if read 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 {
1772 break;
1773 }
1774 }
1775
1776 self.set_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnum().(libcrust-analyzer cargo libc 0.2.169 crate/::makedevrust-analyzer cargo libc 0.2.169 unix/linux_like/linux/makedev().(maj, min));
1777
1778 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1779 }
1780 }
1781
1782 /// Parses the `property` string, and adds an [UdevEntry] to the properties list.
1783 pub fn add_property_from_stringrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string().(&mut self, property: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1784 let mut pit = property.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().('=').takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(2);
1785
1786 let name = pit.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/take/impl#[`Take<I>`][Iterator]next().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("");
1787 let value = pit.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/take/impl#[`Take<I>`][Iterator]next().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("");
1788
1789 self.add_property_internalrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_internal().(name, value)
1790 }
1791
1792 fn add_property_internalrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_internal().(&mut self, key: &str, value: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#> {
1793 if key.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
1794 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
1795 } else {
1796 self.set_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp_uptodate().(false);
1797 if value.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
1798 // remove the matching property if it already exists
1799 self.properties_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]properties_list_mut().().remove_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]remove_entry().(key);
1800 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
1801 } else {
1802 self.properties_list_mutrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]properties_list_mut().().add_entryrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]add_entry().(key, value)
1803 }
1804 }
1805 }
1806
1807 /// Parses property string, and if needed, updates internal values accordingly.
1808 ///
1809 /// From `libudev` documentation:
1810 ///
1811 /// [add_property_from_string_parse_finish()](Self::add_property_from_string_parse_finish) needs to be
1812 /// called after adding properties, and its return value checked.
1813 ///
1814 /// [set_info_loaded()](Self::set_info_loaded) needs to be set, to avoid trying
1815 /// to use a device without a `DEVPATH` set.
1816 pub fn add_property_from_string_parserust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string_parse().(&mut self, property: &str) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
1817 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVPATH=") {
1818 self.set_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_syspath().(path);
1819 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("SUBSYSTEM=") {
1820 self.set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().(path);
1821 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devtype) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVTYPE=") {
1822 self.set_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devtype().(devtype);
1823 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devname) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVNAME=") {
1824 self.set_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode().(devname);
1825 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devlinks) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVLINKS=") {
1826 for link in devlinks.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(' ') {
1827 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().link.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().link.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('\0') {
1828 self.add_devlinkrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_devlink().(link);
1829 }
1830 }
1831 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tags) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("TAGS=") {
1832 for tag in tags.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(':') {
1833 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().tag.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().tag.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('\0') {
1834 self.add_tagrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_tag().(tag)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1835 }
1836 }
1837 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(usec_init) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("USEC_INITIALIZED=") {
1838 self.set_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_usec_initialized().(usec_init.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u64>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1839 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(driver) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DRIVER=") {
1840 self.set_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_driver().(driver);
1841 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(action) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("ACTION=") {
1842 self.set_actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_action().(action);
1843 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(major) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("MAJOR=") {
1844 self.set_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_maj().(major.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1845 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(minor) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("MINOR=") {
1846 self.set_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_min().(minor.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1847 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devpath_old) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVPATH_OLD=") {
1848 self.set_devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath_old().(devpath_old);
1849 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(seqnum) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("SEQNUM=") {
1850 self.set_seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_seqnum().(seqnum.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u64>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1851 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ifindex) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("IFINDEX=") {
1852 self.set_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_ifindex().(ifindex.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1853 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devmode) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVMODE=") {
1854 self.set_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_mode().(devmode.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
1855 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devuid) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVUID=") {
1856 self.set_devnode_uidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_uid().(devuid.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1857 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(devgid) = property.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().("DEVGID=") {
1858 self.set_devnode_gidrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_gid().(devgid.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<u32>().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(0));
1859 } else {
1860 self.add_property_from_stringrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string().(property);
1861 }
1862
1863 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1864 }
1865
1866 /// Finishes adding property information after parsing configuration string.
1867 ///
1868 /// **NOTE** users should call this function after the final call to
1869 /// (add_property_from_string_parse)[Self::add_property_from_string_parse].
1870 pub fn add_property_from_string_parse_finishrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]add_property_from_string_parse_finish().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
1871 if self.majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]maj().() 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 {
1872 self.set_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnum().(libcrust-analyzer cargo libc 0.2.169 crate/::makedevrust-analyzer cargo libc 0.2.169 unix/linux_like/linux/makedev().(self.majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]maj().() as u32, self.minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]min().() as u32));
1873 }
1874
1875 self.set_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_maj().(0);
1876 self.set_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_min().(0);
1877
1878 if self.devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() || self.subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]subsystem().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
1879 logrust-analyzer cargo log 0.4.25 crate/::debugrust-analyzer cargo log 0.4.25 macros/debug!!("device: empty devpath and/or subsystem");
1880 }
1881
1882 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1883 }
1884 }
1885
1886 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice# {
1887 fn defaultrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice][Default]default().() -> Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice][Default] {
1888 Selfrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice][Default]::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#::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().()))
1889 }
1890 }
1891
1892 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice# {
1893 fn fmtrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
1894 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{{")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1895 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""syspath": {},"#, self.syspathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#syspath.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1896 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devpath": {},"#, self.devpathrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1897 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""sysname": {},"#, self.sysnamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysname.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1898 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""sysnum": {},"#, self.sysnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#sysnum.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1899 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devnode": {},"#, self.devnoderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1900 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devnode_mode": {},"#, self.devnode_moderust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_mode.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1901 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devnode_uid": {},"#, self.devnode_uidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_uid.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1902 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devnode_gid": {},"#, self.devnode_gidrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnode_gid.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1903 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""subsystem": {},"#, self.subsystemrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#subsystem.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1904 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devtype": {},"#, self.devtyperust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devtype.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1905 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""driver": {},"#, self.driverrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#driver.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1906 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""action": {},"#, self.actionrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#action.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1907 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devpath_old": {},"#, self.devpath_oldrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devpath_old.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1908 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""id_filename": {},"#, self.id_filenamerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#id_filename.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1909 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""monitor_buf": {},"#, self.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#monitor_buf.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1910 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""seqnum": {},"#, self.seqnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#seqnum.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1911 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""usec_initialized": {},"#, self.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#usec_initialized.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1912 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devlink_priority": {},"#, self.devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devlink_priority.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1913 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""devnum": {},"#, self.devnumrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#devnum.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1914 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""ifindex": {},"#, self.ifindexrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#ifindex.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1915 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""watch_handle": {},"#, self.watch_handlerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#watch_handle.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1916 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""maj": {},"#, self.majrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#maj.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1917 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, r#""min": {}"#, self.minrust-analyzer cargo udevrs 0.4.0 device/UdevDevice#min.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1918 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "}}")
1919 }
1920 }
1921
1922 #[cfg(test)]
1923 mod testsrust-analyzer cargo udevrs 0.4.0 device/tests/ {
1924 use superrust-analyzer cargo udevrs 0.4.0 device/::*;
1925 use craterust-analyzer cargo udevrs 0.4.0 crate/::UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#;
1926
1927 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1928 fn test_udev_devicerust-analyzer cargo udevrs 0.4.0 device/tests/test_udev_device().() {
1929 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().());
1930 let mut null_dev = 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));
1931
1932 let exp_syspath = "test_syspath";
1933 let exp_devpath = "test_devpath";
1934 let exp_sysname = "test_sysname";
1935 let exp_sysnum = "test_sysnum";
1936 let exp_devnode = "test_devnode";
1937 let exp_devnode_mode = Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#::EXEC_OTHERrust-analyzer cargo udevrs 0.4.0 mode/impl#[Mode]EXEC_OTHER.;
1938 let exp_subsystem = "test_subsystem";
1939 let exp_devtype = "test_devtype";
1940 let exp_driver = "test_driver";
1941 let exp_action = "test_action";
1942 let exp_devpath_old = "test_devpath_old";
1943 let exp_id_filename = "test_id_filename";
1944 let exp_envp = ["test_envp"];
1945 let exp_monitor_buf = "test_monitor_buf";
1946
1947 let exp_devlinks = [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_devlinks")];
1948 let exp_properties = [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")];
1949 let exp_sysattr_value = [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_value")];
1950 let exp_sysattr = [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")];
1951 let exp_tags = [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")];
1952
1953 let exp_seqnum = 1;
1954 let exp_usec_initialized = 2;
1955 let exp_devlink_priority = 3;
1956 let exp_devnum = 4;
1957 let exp_ifindex = 5;
1958 let exp_watch_handle = 6;
1959 let exp_maj = 7;
1960 let exp_min = 8;
1961
1962 let exp_devlinks_uptodate = true;
1963 let exp_envp_uptodate = true;
1964 let exp_tags_uptodate = true;
1965 let exp_info_loaded = true;
1966 let exp_db_loaded = true;
1967 let exp_uevent_loaded = true;
1968 let exp_is_initialized = true;
1969 let exp_sysattr_list_read = true;
1970 let exp_db_persist = true;
1971
1972 let exp_dev = UdevDevicerust-analyzer cargo udevrs 0.4.0 device/UdevDevice#::newrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]new().(udev)
1973 .with_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_syspath().(exp_syspath)
1974 .with_devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devpath().(exp_devpath)
1975 .with_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysname().(exp_sysname)
1976 .with_sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysnum().(exp_sysnum)
1977 .with_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnode().(exp_devnode)
1978 .with_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnode_mode().(exp_devnode_mode)
1979 .with_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_subsystem().(exp_subsystem)
1980 .with_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devtype().(exp_devtype)
1981 .with_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_driver().(exp_driver)
1982 .with_actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_action().(exp_action)
1983 .with_devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devpath_old().(exp_devpath_old)
1984 .with_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_id_filename().(exp_id_filename)
1985 .with_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_envp().(&exp_envp)
1986 .with_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_monitor_buf().(exp_monitor_buf)
1987 .with_devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devlinks_list().(exp_devlinks.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
1988 .with_properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_properties_list().(exp_properties.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
1989 .with_sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysattr_value_list().(exp_sysattr_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
1990 .with_sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysattr_list().(exp_sysattr.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
1991 .with_tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_tags_list().(exp_tags.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().())
1992 .with_seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_seqnum().(exp_seqnum)
1993 .with_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_usec_initialized().(exp_usec_initialized)
1994 .with_devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devlink_priority().(exp_devlink_priority)
1995 .with_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devnum().(exp_devnum)
1996 .with_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_ifindex().(exp_ifindex)
1997 .with_watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_watch_handle().(exp_watch_handle)
1998 .with_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_maj().(exp_maj)
1999 .with_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_min().(exp_min)
2000 .with_devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_devlinks_uptodate().(exp_devlinks_uptodate)
2001 .with_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_envp_uptodate().(exp_envp_uptodate)
2002 .with_tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_tags_uptodate().(exp_tags_uptodate)
2003 .with_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_info_loaded().(exp_info_loaded)
2004 .with_db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_db_loaded().(exp_db_loaded)
2005 .with_uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_uevent_loaded().(exp_uevent_loaded)
2006 .with_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_is_initialized().(exp_is_initialized)
2007 .with_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_sysattr_list_read().(exp_sysattr_list_read)
2008 .with_db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]with_db_persist().(exp_db_persist);
2009
2010 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().(), "");
2011 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().(), "");
2012 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysname().(), "");
2013 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysnum().(), "");
2014 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode().(), "");
2015 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode_mode().(), Moderust-analyzer cargo udevrs 0.4.0 mode/Mode#::NONErust-analyzer cargo udevrs 0.4.0 mode/impl#[Mode]NONE.);
2016 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]subsystem().(), "");
2017 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devtype().(), "");
2018 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]driver().(), "");
2019 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]action().(), "");
2020 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath_old().(), "");
2021 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]id_filename().(), "");
2022 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_dev.envp_is_emptyrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_is_empty().());
2023 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]monitor_buf().(), "");
2024 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_dev.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
2025 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_dev.properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]properties_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
2026 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_dev.sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_value_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
2027 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_dev.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
2028 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_dev.tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_list().().is_emptyrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]is_empty().());
2029 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]seqnum().(), 0);
2030 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]usec_initialized().(), 0);
2031 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlink_priority().(), 0);
2032 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnum().(), 0);
2033 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]ifindex().(), 0);
2034 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]watch_handle().(), 0);
2035 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]maj().(), 0);
2036 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev.minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]min().(), 0);
2037 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_dev.devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_uptodate().());
2038 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_dev.envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_uptodate().());
2039 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_dev.tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_uptodate().());
2040 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_dev.info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]info_loaded().());
2041 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_dev.db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_loaded().());
2042 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_dev.uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]uevent_loaded().());
2043 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_dev.is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]is_initialized().());
2044 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_dev.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_list_read().());
2045 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_dev.db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_persist().());
2046
2047 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]syspath().(), exp_syspath);
2048 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath().(), exp_devpath);
2049 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysname().(), exp_sysname);
2050 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysnum().(), exp_sysnum);
2051 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode().(), exp_devnode);
2052 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnode_mode().(), exp_devnode_mode);
2053 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]subsystem().(), exp_subsystem);
2054 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devtype().(), exp_devtype);
2055 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]driver().(), exp_driver);
2056 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]action().(), exp_action);
2057 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devpath_old().(), exp_devpath_old);
2058 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]id_filename().(), exp_id_filename);
2059 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp().(), exp_envp);
2060 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]monitor_buf().(), exp_monitor_buf);
2061
2062 for (item, exp_item) in exp_dev.devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_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_devlinks.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
2063 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(item, exp_item);
2064 }
2065
2066 for (item, exp_item) in exp_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().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_properties.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
2067 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(item, exp_item);
2068 }
2069
2070 for (item, exp_item) in exp_dev
2071 .sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_value_list().()
2072 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
2073 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_sysattr_value.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().())
2074 {
2075 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(item, exp_item);
2076 }
2077
2078 for (item, exp_item) in exp_dev.sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_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_sysattr.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
2079 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(item, exp_item);
2080 }
2081
2082 for (item, exp_item) in exp_dev.tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_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_tags.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
2083 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(item, exp_item);
2084 }
2085
2086 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]seqnum().(), exp_seqnum);
2087 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]usec_initialized().(), exp_usec_initialized);
2088 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlink_priority().(), exp_devlink_priority);
2089 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devnum().(), exp_devnum);
2090 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]ifindex().(), exp_ifindex);
2091 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]watch_handle().(), exp_watch_handle);
2092 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]maj().(), exp_maj);
2093 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]min().(), exp_min);
2094 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]devlinks_uptodate().(), exp_devlinks_uptodate);
2095 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]envp_uptodate().(), exp_envp_uptodate);
2096 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]tags_uptodate().(), exp_tags_uptodate);
2097 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]info_loaded().(), exp_info_loaded);
2098 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_loaded().(), exp_db_loaded);
2099 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]uevent_loaded().(), exp_uevent_loaded);
2100 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]is_initialized().(), exp_is_initialized);
2101 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]sysattr_list_read().(), exp_sysattr_list_read);
2102 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_dev.db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]db_persist().(), exp_db_persist);
2103
2104 null_dev.set_syspathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_syspath().(exp_syspath);
2105 null_dev.set_devpathrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath().(exp_devpath);
2106 null_dev.set_sysnamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysname().(exp_sysname);
2107 null_dev.set_sysnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysnum().(exp_sysnum);
2108 null_dev.set_devnoderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode().(exp_devnode);
2109 null_dev.set_devnode_moderust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnode_mode().(exp_devnode_mode);
2110 null_dev.set_subsystemrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_subsystem().(exp_subsystem);
2111 null_dev.set_devtyperust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devtype().(exp_devtype);
2112 null_dev.set_driverrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_driver().(exp_driver);
2113 null_dev.set_actionrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_action().(exp_action);
2114 null_dev.set_devpath_oldrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devpath_old().(exp_devpath_old);
2115 null_dev.set_id_filenamerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_id_filename().(exp_id_filename);
2116 null_dev.set_envprust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp().(&exp_envp);
2117 null_dev.set_monitor_bufrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_monitor_buf().(exp_monitor_buf);
2118 null_dev.set_devlinks_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_list().(exp_devlinks.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
2119 null_dev.set_properties_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_properties_list().(exp_properties.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
2120 null_dev.set_sysattr_value_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_value_list().(exp_sysattr_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
2121 null_dev.set_sysattr_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_list().(exp_sysattr.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
2122 null_dev.set_tags_listrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_list().(exp_tags.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
2123 null_dev.set_seqnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_seqnum().(exp_seqnum);
2124 null_dev.set_usec_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_usec_initialized().(exp_usec_initialized);
2125 null_dev.set_devlink_priorityrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlink_priority().(exp_devlink_priority);
2126 null_dev.set_devnumrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devnum().(exp_devnum);
2127 null_dev.set_ifindexrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_ifindex().(exp_ifindex);
2128 null_dev.set_watch_handlerust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_watch_handle().(exp_watch_handle);
2129 null_dev.set_majrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_maj().(exp_maj);
2130 null_dev.set_minrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_min().(exp_min);
2131 null_dev.set_devlinks_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_devlinks_uptodate().(exp_devlinks_uptodate);
2132 null_dev.set_envp_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_envp_uptodate().(exp_envp_uptodate);
2133 null_dev.set_tags_uptodaterust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_tags_uptodate().(exp_tags_uptodate);
2134 null_dev.set_info_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_info_loaded().(exp_info_loaded);
2135 null_dev.set_db_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_db_loaded().(exp_db_loaded);
2136 null_dev.set_uevent_loadedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_uevent_loaded().(exp_uevent_loaded);
2137 null_dev.set_is_initializedrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_is_initialized().(exp_is_initialized);
2138 null_dev.set_sysattr_list_readrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_sysattr_list_read().(exp_sysattr_list_read);
2139 null_dev.set_db_persistrust-analyzer cargo udevrs 0.4.0 device/impl#[UdevDevice]set_db_persist().(exp_db_persist);
2140
2141 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_dev, exp_dev);
2142 }
2143 }