Debian Codegraph @

src/context.rs

raw symbols SCIP
1 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/, 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/, iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, 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#};
2
3 use craterust-analyzer cargo udevrs 0.4.0 crate/::{file_handlerust-analyzer cargo udevrs 0.4.0 file/file_handle#, name_to_handle_atrust-analyzer cargo udevrs 0.4.0 file/name_to_handle_at()., Errorrust-analyzer cargo udevrs 0.4.0 error/Error#, LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#, Resultrust-analyzer cargo udevrs 0.4.0 error/Result#, UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#, UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#};
4
5 pub const RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.: usize = 4;
6
7 /// libudev context
8 ///
9 /// The context contains the default values read from the udev config file,
10 /// and is passed to all library operations.
11 #[repr(C)]
12 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
13 pub struct Udevrust-analyzer cargo udevrs 0.4.0 context/Udev# {
14 sys_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#sys_path.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
15 dev_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#dev_path.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
16 rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path.: [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#; RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.],
17 rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path_ts.: [u64; RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.],
18 run_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#run_path.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
19 properties_listrust-analyzer cargo udevrs 0.4.0 context/Udev#properties_list.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#>,
20 log_priorityrust-analyzer cargo udevrs 0.4.0 context/Udev#log_priority.: LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#,
21 }
22
23 impl Udevrust-analyzer cargo udevrs 0.4.0 context/Udev# {
24 /// Creates a new [Udev].
25 pub fn newrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]new().() -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
26 Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
27 sys_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#sys_path.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
28 dev_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#dev_path.: 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().(),
29 rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path.: [""; RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_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().),
30 rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path_ts.: [0; RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.],
31 run_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#run_path.: 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().(),
32 properties_listrust-analyzer cargo udevrs 0.4.0 context/Udev#properties_list.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
33 log_priorityrust-analyzer cargo udevrs 0.4.0 context/Udev#log_priority.: LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::newrust-analyzer cargo udevrs 0.4.0 log/impl#[LogPriority]new().(),
34 }
35 }
36
37 /// Convenience function for `udev` log messages.
38 pub fn logrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]log().<M: 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#>(&self, priority: LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#, msg: M) {
39 if priority rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().self.log_priorityrust-analyzer cargo udevrs 0.4.0 context/Udev#log_priority. {
40 match priority {
41 LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Emergencyrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Emergency#
42 | LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Alertrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Alert#
43 | LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Criticalrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Critical#
44 | LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Errorrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Error# => logrust-analyzer cargo log 0.4.25 crate/::errorrust-analyzer cargo log 0.4.25 macros/error!!("{priority}: {msg}"),
45 LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Warningrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Warning# => logrust-analyzer cargo log 0.4.25 crate/::warnrust-analyzer cargo log 0.4.25 macros/warn!!("{priority}: {msg}"),
46 LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Noticerust-analyzer cargo udevrs 0.4.0 log/LogPriority#Notice# | LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Inforust-analyzer cargo udevrs 0.4.0 log/LogPriority#Info# => logrust-analyzer cargo log 0.4.25 crate/::inforust-analyzer cargo log 0.4.25 macros/info!!("{priority}: {msg}"),
47 LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Debugrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Debug# => logrust-analyzer cargo log 0.4.25 crate/::debugrust-analyzer cargo log 0.4.25 macros/debug!!("{priority}: {msg}"),
48 }
49 }
50 }
51
52 /// Gets the system path.
53 pub fn sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]sys_path().(&self) -> &str {
54 self.sys_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#sys_path..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
55 }
56
57 /// Sets the system path.
58 pub fn set_sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_sys_path().<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, path: P) {
59 self.sys_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#sys_path. = path.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
60 }
61
62 /// Builder function that sets the system path.
63 pub fn with_sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_sys_path().<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, path: P) -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
64 self.set_sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_sys_path().(path);
65 self
66 }
67
68 /// Gets the device path.
69 pub fn dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]dev_path().(&self) -> &str {
70 self.dev_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#dev_path..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
71 }
72
73 /// Sets the device path.
74 pub fn set_dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_dev_path().<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, path: P) {
75 self.dev_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#dev_path. = path.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
76 }
77
78 /// Builder function that sets the device path.
79 pub fn with_dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_dev_path().<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, path: P) -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
80 self.set_dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_dev_path().(path);
81 self
82 }
83
84 /// Gets a reference to the list of rules paths.
85 pub fn rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path().(&self) -> &[Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#] {
86 let len = self.rules_path_countrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_count().();
87 self.rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path.[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().()
88 }
89
90 /// Gets a mutable reference to the list of rules paths.
91 pub fn rules_path_mutrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_mut().(&mut self) -> &mut [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#] {
92 let len = self.rules_path_countrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_count().();
93 self.rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path.[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()..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[`[T]`][`AsMut<Self>`]as_mut().()
94 }
95
96 /// Sets the list of rules paths.
97 pub fn set_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path().<R: 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, rules: &[R]) {
98 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().(rules.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.);
99 self.rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path.[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().
100 .iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().()
101 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(rules[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#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..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().())
102 .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().());
103 self.rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path.[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().
104 .iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().()
105 .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]for_each().(|s| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().s = 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().());
106 }
107
108 /// Builder function that sets the list of rules paths.
109 pub fn with_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_rules_path().<R: 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, rules: &[R]) -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
110 self.set_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path().(rules);
111 self
112 }
113
114 /// Gets a reference to the list of rules path timestamps.
115 pub fn rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts().(&self) -> &[u64] {
116 let len = self.rules_path_countrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_count().();
117 self.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path_ts.[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().()
118 }
119
120 /// Gets a mutable reference to the list of rules path timestamps.
121 pub fn rules_path_ts_mutrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts_mut().(&mut self) -> &mut [u64] {
122 let len = self.rules_path_countrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_count().();
123 self.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path_ts.[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()..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[`[T]`][`AsMut<Self>`]as_mut().()
124 }
125
126 /// Sets the list of rules path timestamps.
127 pub fn set_rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path_ts().<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<u64> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#>(&mut self, ts: &[T]) {
128 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().(ts.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.);
129 self.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path_ts.[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().
130 .iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().()
131 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(ts[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#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..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().())
132 .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().());
133 }
134
135 /// Builder function that sets the list of rules path timestamps.
136 pub fn with_rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_rules_path_ts().<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<u64> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#>(mut self, ts: &[T]) -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
137 self.set_rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path_ts().(ts);
138 self
139 }
140
141 /// Gets the number of populated rules path entries.
142 pub fn rules_path_countrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_count().(&self) -> usize {
143 self.rules_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#rules_path..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().(|p| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().p.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().()
144 }
145
146 /// Gets the run path.
147 pub fn run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]run_path().(&self) -> &str {
148 self.run_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#run_path..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()
149 }
150
151 /// Sets the run path.
152 pub fn set_run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_run_path().<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, path: P) {
153 self.run_pathrust-analyzer cargo udevrs 0.4.0 context/Udev#run_path. = path.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
154 }
155
156 /// Builder function that sets the run path.
157 pub fn with_run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_run_path().<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, path: P) -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
158 self.set_run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_run_path().(path);
159 self
160 }
161
162 /// Gets a reference to the properties list [UdevList].
163 ///
164 /// **NOTE** User is responsible for initializing the [`properties_list`](UdevList) before calling.
165 pub fn properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]properties_list().(&self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#> {
166 self.properties_listrust-analyzer cargo udevrs 0.4.0 context/Udev#properties_list.
167 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
168 .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#::Udevrust-analyzer cargo udevrs 0.4.0 error/Error#Udev#("context: missing properties_list".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
169 }
170
171 /// Gets a mutable reference to the properties list [UdevList].
172 ///
173 /// **NOTE** User is responsible for initializing the [`properties_list`](UdevList) before calling.
174 pub fn properties_list_mutrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]properties_list_mut().(&mut self) -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<&mut UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#> {
175 self.properties_listrust-analyzer cargo udevrs 0.4.0 context/Udev#properties_list.
176 .as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().()
177 .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#::Udevrust-analyzer cargo udevrs 0.4.0 error/Error#Udev#("context: missing properties_list".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))
178 }
179
180 /// Sets the properties list [UdevList].
181 pub fn set_properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_properties_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(arc: &mut Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]>, list: L) {
182 let udev_arc = 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().(arc);
183 let udev = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::make_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`]make_mut().(arc);
184
185 match udev.properties_listrust-analyzer cargo udevrs 0.4.0 context/Udev#properties_list..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().() {
186 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prop_list) => prop_list.set_listrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]set_list().(list),
187 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => udev.properties_listrust-analyzer cargo udevrs 0.4.0 context/Udev#properties_list. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(UdevListrust-analyzer cargo udevrs 0.4.0 list/UdevList#::createrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]create().(udev_arc, list.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())),
188 }
189 }
190
191 /// Builder function that sets the properties list [UdevList].
192 pub fn with_properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_properties_list().<L: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<UdevEntryListrust-analyzer cargo udevrs 0.4.0 list/UdevEntryList#>>(mut arc: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]>, list: L) -> Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]> {
193 Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::set_properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_properties_list().(&mut arc, list);
194 arc
195 }
196
197 /// Gets the [LogPriority].
198 pub const fn log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]log_priority().(&self) -> LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority# {
199 self.log_priorityrust-analyzer cargo udevrs 0.4.0 context/Udev#log_priority.
200 }
201
202 /// Sets the [LogPriority].
203 pub fn set_log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_log_priority().<P: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#>>(&mut self, priority: P) {
204 self.log_priorityrust-analyzer cargo udevrs 0.4.0 context/Udev#log_priority. = priority.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
205 }
206
207 /// Builder function that sets the [LogPriority].
208 pub fn with_log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_log_priority().<P: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#>>(mut self, priority: P) -> Selfrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev] {
209 self.set_log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_log_priority().(priority);
210 self
211 }
212
213 /// Gets whether `/dev` is mounted on `devtmpfs`.
214 pub fn has_devtmpfsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]has_devtmpfs().(&self) -> bool {
215 use iorust-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#;
216
217 let mut handle = file_handlerust-analyzer cargo udevrs 0.4.0 file/file_handle#::newrust-analyzer cargo udevrs 0.4.0 file/impl#[file_handle]new().();
218 let mut mount_id = 0i32;
219
220 if let (Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(f), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_)) = (
221 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().()
222 .readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]read().(true)
223 .openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[OpenOptions]open().("/proc/self/mountinfo"),
224 name_to_handle_atrust-analyzer cargo udevrs 0.4.0 file/name_to_handle_at().(libcrust-analyzer cargo libc 0.2.169 crate/::AT_FDCWDrust-analyzer cargo libc 0.2.169 unix/linux_like/AT_FDCWD., "/dev", &mut handle, &mut mount_id, 0),
225 ) {
226 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);
227 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().();
228 let mut ret = false;
229
230 while reader.read_linerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#read_line().(&mut line).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
231 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mid) = line.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<i32>() {
232 if mid 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().mount_id {
233 continue;
234 }
235 } else {
236 continue;
237 }
238
239 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) = line.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(" - ") {
240 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(p) = line[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().e..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()..strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().(" - ") {
241 // accept any name that starts with the currently expected type
242 if p.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("devtmpfs") {
243 ret = true;
244 break;
245 }
246 }
247 }
248 }
249
250 ret
251 } else {
252 false
253 }
254 }
255 }
256
257 #[cfg(test)]
258 mod testsrust-analyzer cargo udevrs 0.4.0 context/tests/ {
259 use superrust-analyzer cargo udevrs 0.4.0 context/::*;
260 use craterust-analyzer cargo udevrs 0.4.0 crate/::UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#;
261
262 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
263 fn test_udevrust-analyzer cargo udevrs 0.4.0 context/tests/test_udev().() -> Resultrust-analyzer cargo udevrs 0.4.0 error/Result#<()> {
264 let mut null_udev = Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::newrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]new().();
265
266 let exp_sys_path = "test_sys_path";
267 let exp_dev_path = "test_dev_path";
268 let exp_rules_path =
269 ["test_rules0", "test_rules1", "test_rules2", "test_rules3"].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().);
270 let exp_rules_ts = [17092390, 17092391, 17092392, 17092393];
271 let exp_run_path = "test_run_path";
272 let exp_prop_list = [UdevEntryrust-analyzer cargo udevrs 0.4.0 list/UdevEntry#::newrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]new().().with_namerust-analyzer cargo udevrs 0.4.0 list/impl#[UdevEntry]with_name().("test_entry_name")];
273 let exp_log_prio = LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::Debugrust-analyzer cargo udevrs 0.4.0 log/LogPriority#Debug#;
274
275 let exp_udev = Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::newrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]new().()
276 .with_sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_sys_path().(exp_sys_path)
277 .with_dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_dev_path().(exp_dev_path)
278 .with_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_rules_path().(&exp_rules_path)
279 .with_rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_rules_path_ts().(&exp_rules_ts)
280 .with_run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_run_path().(exp_run_path)
281 .with_log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_log_priority().(exp_log_prio);
282
283 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]sys_path().(), "");
284 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]dev_path().(), "");
285 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_udev.rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
286 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_udev.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
287 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]run_path().(), "");
288 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(null_udev.properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]properties_list().().is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
289 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]log_priority().(), LogPriorityrust-analyzer cargo udevrs 0.4.0 log/LogPriority#::newrust-analyzer cargo udevrs 0.4.0 log/impl#[LogPriority]new().());
290
291 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_udev.sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]sys_path().(), exp_sys_path);
292 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_udev.dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]dev_path().(), exp_dev_path);
293 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_udev.rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path().(), exp_rules_path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().());
294 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_udev.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts().(), exp_rules_ts.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().());
295 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_udev.run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]run_path().(), exp_run_path);
296
297 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(exp_udev.log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]log_priority().(), exp_log_prio);
298
299 null_udev.set_sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_sys_path().(exp_sys_path);
300 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.sys_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]sys_path().(), exp_sys_path);
301
302 null_udev.set_dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_dev_path().(exp_dev_path);
303 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.dev_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]dev_path().(), exp_dev_path);
304
305 null_udev.set_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path().(&exp_rules_path);
306 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path().(), exp_rules_path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().());
307
308 null_udev.set_rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path_ts().(&exp_rules_ts);
309 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts().(), exp_rules_ts.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().());
310
311 null_udev.set_run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_run_path().(exp_run_path);
312 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.run_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]run_path().(), exp_run_path);
313
314 null_udev.set_log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_log_priority().(exp_log_prio);
315 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.log_priorityrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]log_priority().(), exp_log_prio);
316
317 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev, exp_udev);
318
319 // Check that setting a short rules path only returns the short list.
320 null_udev.set_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path().(&exp_rules_path[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#1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().);
321 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path().(), &exp_rules_path[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().);
322 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.rules_path_mutrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_mut().(), &exp_rules_path[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().);
323 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts().(), &exp_rules_ts[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().);
324
325 // Check that a maximum of `RULES_PATH_LEN` items are set
326 let oversize_rules_path = ["over"; RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1].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().);
327 null_udev.set_rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_rules_path().(&oversize_rules_path);
328 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
329 null_udev.rules_pathrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path().(),
330 &oversize_rules_path[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...RULES_PATH_LENrust-analyzer cargo udevrs 0.4.0 context/RULES_PATH_LEN.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().
331 );
332 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev.rules_path_tsrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]rules_path_ts().(), &exp_rules_ts);
333
334 let mut null_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().(null_udev);
335 Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::set_properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]set_properties_list().(&mut null_udev, exp_prop_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
336
337 for (prop, exp_prop) in null_udev
338 .properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]properties_list().()
339 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
340 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
341 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_prop_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().())
342 {
343 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prop, exp_prop);
344 }
345
346 let exp_udev = Udevrust-analyzer cargo udevrs 0.4.0 context/Udev#::with_properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]with_properties_list().(null_udev.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(), exp_prop_list.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().());
347
348 for (prop, exp_prop) in exp_udev
349 .properties_listrust-analyzer cargo udevrs 0.4.0 context/impl#[Udev]properties_list().()
350 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
351 .iterrust-analyzer cargo udevrs 0.4.0 list/impl#[UdevList]iter().()
352 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(exp_prop_list.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().())
353 {
354 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(prop, exp_prop);
355 }
356
357 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(null_udev, exp_udev);
358
359 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
360 }
361 }