Debian Codegraph @

src/config.rs

raw symbols SCIP
1 //! Contains config related structs and functions.
2
3 use cxxrust-analyzer cargo cxx 1.0.199 crate/::UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#;
4
5 /// Struct for Apt Configuration
6 ///
7 /// All apt configuration methods do not require this struct.
8 /// You can call the bindings directly from raw::apt if you would like.
9 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
10 pub struct Configrust-analyzer cargo rust-apt 0.8.0 config/Config# {}
11
12 // TODO: ConfigTree can (signal: 11, SIGSEGV: invalid memory reference)
13 // if you get a ConfigTree object and then clear the config with clear_all
14 // Make clear_all consume the Config struct and make ConfigTree have a lifetime
15 // to it?
16
17 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Configrust-analyzer cargo rust-apt 0.8.0 config/Config# {
18 /// Create a new config object and safely init the config system.
19 ///
20 /// If you initialize the struct without `new()` or `default()`
21 /// You will need to manually initialize the config system.
22 fn defaultrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config][Default]default().() -> Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config][Default] { Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config][Default]::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]new().() }
23 }
24 // TODO: I think we should not accept &str if we just call to_string() anyway
25 impl Configrust-analyzer cargo rust-apt 0.8.0 config/Config# {
26 /// Create a new config object and safely init the config system.
27 ///
28 /// If you initialize the struct without `new()` or `default()`
29 /// You will need to manually initialize the config system.
30 pub fn newrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]new().() -> Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config] {
31 init_config_systemrust-analyzer cargo rust-apt 0.8.0 config/init_config_system().();
32 Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config] {}
33 }
34
35 /// Clears all configuratations, re-initialize, and returns the config
36 /// object.
37 pub fn new_clearrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]new_clear().() -> Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config] {
38 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::clear_allrust-analyzer cargo rust-apt 0.8.0 config/raw/clear_all().();
39 Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]new().()
40 }
41
42 /// Resets the configurations.
43 ///
44 /// If you'd like to clear everything and NOT reinit
45 /// you can call `self.clear_all` or `raw::clear_all` directly
46 pub fn resetrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]reset().(&self) {
47 self.clear_allrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]clear_all().();
48 init_config_systemrust-analyzer cargo rust-apt 0.8.0 config/init_config_system().();
49 }
50
51 /// Clears all values from a key.
52 ///
53 /// If the value is a list, the entire list is cleared.
54 /// If you need to clear 1 value from a list see `self.clear_value`
55 pub fn clearrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]clear().(&self, key: &str) { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::clearrust-analyzer cargo rust-apt 0.8.0 config/raw/clear().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); }
56
57 /// Clear a single value from a list.
58 /// Used for removing one item in an apt configuruation list
59 pub fn clear_valuerust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]clear_value().(&self, key: &str, value: &str) {
60 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::clear_valuerust-analyzer cargo rust-apt 0.8.0 config/raw/clear_value().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
61 }
62
63 /// Clears all configuratations.
64 ///
65 /// This will leave you with an empty configuration object
66 /// and most things probably won't work right.
67 pub fn clear_allrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]clear_all().(&self) { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::clear_allrust-analyzer cargo rust-apt 0.8.0 config/raw/clear_all().(); }
68
69 /// Returns a string dump of configuration options separated by `\n`
70 pub fn dumprust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]dump().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::dumprust-analyzer cargo rust-apt 0.8.0 config/raw/dump().() }
71
72 /// Find a key and return it's value as a string.
73 ///
74 /// default is what will be returned if nothing is found.
75 pub fn findrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]find().(&self, key: &str, default: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
76 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::findrust-analyzer cargo rust-apt 0.8.0 config/raw/find().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), default.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
77 }
78
79 /// Exactly like find but takes no default and returns an option instead.
80 pub fn getrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]get().(&self, key: &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#> {
81 let value = rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::findrust-analyzer cargo rust-apt 0.8.0 config/raw/find().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
82 if value.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
83 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
84 }
85 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value)
86 }
87
88 /// Find a file and return it's value as a string.
89 ///
90 /// default is what will be returned if nothing is found.
91 ///
92 /// `key = "Dir::Cache::pkgcache"` should return
93 /// `/var/cache/apt/pkgcache.bin`
94 ///
95 /// There is not much difference in `self.dir` and `self.file`
96 ///
97 /// `dir` will return with a trailing `/` where `file` will not.
98 pub fn filerust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]file().(&self, key: &str, default: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
99 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::find_filerust-analyzer cargo rust-apt 0.8.0 config/raw/find_file().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), default.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
100 }
101
102 /// Find a directory and return it's value as a string.
103 ///
104 /// default is what will be returned if nothing is found.
105 ///
106 /// `key = "Dir::Etc::sourceparts"` should return `/etc/apt/sources.list.d/`
107 ///
108 /// There is not much difference in `self.dir` and `self.file`
109 ///
110 /// `dir` will return with a trailing `/` where `file` will not.
111 pub fn dirrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]dir().(&self, key: &str, default: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
112 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::find_dirrust-analyzer cargo rust-apt 0.8.0 config/raw/find_dir().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), default.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
113 }
114
115 /// Same as find, but for boolean values.
116 pub fn boolrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]bool().(&self, key: &str, default: bool) -> bool {
117 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::find_boolrust-analyzer cargo rust-apt 0.8.0 config/raw/find_bool().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), default)
118 }
119
120 /// Same as find, but for i32 values.
121 pub fn intrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]int().(&self, key: &str, default: i32) -> i32 { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::find_intrust-analyzer cargo rust-apt 0.8.0 config/raw/find_int().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), default) }
122
123 /// Return a vector for an Apt configuration list.
124 ///
125 /// An example of a common key that contains a list `raw::NeverAutoRemove`.
126 pub fn find_vectorrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]find_vector().(&self, key: &str) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::find_vectorrust-analyzer cargo rust-apt 0.8.0 config/raw/find_vector().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) }
127
128 /// Return a vector of supported architectures on this system.
129 /// The main architecture is the first in the list.
130 pub fn get_architecturesrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]get_architectures().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::get_architecturesrust-analyzer cargo rust-apt 0.8.0 config/raw/get_architectures().() }
131
132 /// Simply check if a key exists.
133 pub fn containsrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]contains().(&self, key: &str) -> bool { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::existsrust-analyzer cargo rust-apt 0.8.0 config/raw/exists().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) }
134
135 /// Set the given key to the specified value.
136 pub fn setrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]set().(&self, key: &str, value: &str) { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::setrust-analyzer cargo rust-apt 0.8.0 config/raw/set().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) }
137
138 pub fn treerust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]tree().(&self, key: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#> {
139 let tree = unsafe { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::treerust-analyzer cargo rust-apt 0.8.0 config/raw/tree().(key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) };
140 if tree.endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().() {
141 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
142 }
143 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(tree))
144 }
145
146 pub fn root_treerust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]root_tree().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#> {
147 let tree = unsafe { rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::root_treerust-analyzer cargo rust-apt 0.8.0 config/raw/root_tree().() };
148 if tree.endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().() {
149 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
150 }
151 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(tree))
152 }
153
154 /// Add strings from a vector into an apt configuration list.
155 ///
156 /// If the configuration key is not a list,
157 /// you will receive a vector with one item.
158 ///
159 /// Example:
160 /// ```
161 /// use rust_apt::config::Config;
162 /// let config = Config::new();
163 ///
164 /// let apt_list = vec!["This", "is", "my", "apt", "list"];
165 /// // Using "AptList" here will not work and will panic.
166 /// config.set_vector("AptList", &apt_list);
167 /// ```
168 pub fn set_vectorrust-analyzer cargo rust-apt 0.8.0 config/impl#[Config]set_vector().(&self, key: &str, values: &Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>) {
169 let mut vec_key = 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().(key);
170 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().vec_key.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().("::") {
171 vec_key.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().("::");
172 }
173
174 for value in values {
175 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::setrust-analyzer cargo rust-apt 0.8.0 config/raw/set().(vec_key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
176 }
177 }
178 }
179
180 pub struct ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree# {
181 pub ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr.: UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>,
182 }
183
184 impl ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree# {
185 pub fn newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(ptr: UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>) -> Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree] { ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree# { ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr. } }
186
187 pub fn tagrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]tag().(&self) -> 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#> {
188 let tag = self.ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..tagrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]tag().();
189 if tag.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
190 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
191 }
192 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tag)
193 }
194
195 pub fn valuerust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]value().(&self) -> 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#> {
196 let value = self.ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..valuerust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]value().();
197 if value.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() {
198 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
199 }
200 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value)
201 }
202
203 pub fn childrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]child().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#> {
204 let child = unsafe { self.ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..childrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]child().() };
205 if child.endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().() { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } else { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(child)) }
206 }
207
208 pub fn siblingrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]sibling().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#> {
209 let child = unsafe { self.ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..raw_nextrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]raw_next().() };
210 if child.endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().() { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } else { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(child)) }
211 }
212
213 pub fn parentrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]parent().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#> {
214 let parent = unsafe { self.ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..parentrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]parent().() };
215 if parent.endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().() { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } else { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(parent)) }
216 }
217
218 pub fn iterrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]iter().(&self) -> IterConfigTreerust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree# {
219 IterConfigTreerust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#(unsafe { ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(self.ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..uniquerust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]unique().()) })
220 }
221 }
222
223 impl IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree# {
224 type IntoIterrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree][IntoIterator]IntoIter# = IterConfigTreerust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#;
225 type Itemrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree][IntoIterator]Item# = ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#;
226
227 fn into_iterrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { IterConfigTreerust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#(self) }
228 }
229
230 pub struct IterConfigTreerust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#);
231
232 impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for IterConfigTreerust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree# {
233 type Itemrust-analyzer cargo rust-apt 0.8.0 config/impl#[IterConfigTree][Iterator]Item# = ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#;
234
235 fn nextrust-analyzer cargo rust-apt 0.8.0 config/impl#[IterConfigTree][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rust-apt 0.8.0 config/impl#[IterConfigTree][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
236 if self.0rust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#0..ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().() {
237 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
238 } else {
239 let ret = unsafe { self.0rust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#0..ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..uniquerust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]unique().() };
240 let next = unsafe { self.0rust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#0..ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr..raw_nextrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]raw_next().() };
241 self.0rust-analyzer cargo rust-apt 0.8.0 config/IterConfigTree#0..ptrrust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#ptr. = next;
242 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/ConfigTree#::newrust-analyzer cargo rust-apt 0.8.0 config/impl#[ConfigTree]new().(ret))
243 }
244 }
245 }
246
247 /// Safely Init Apt Configuration and System.
248 ///
249 /// If the configuration has already been initialized, don't reinit.
250 ///
251 /// This could cause some things to get reset.
252 pub fn init_config_systemrust-analyzer cargo rust-apt 0.8.0 config/init_config_system().() {
253 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::existsrust-analyzer cargo rust-apt 0.8.0 config/raw/exists().("APT::Architecture".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) {
254 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::init_configrust-analyzer cargo rust-apt 0.8.0 config/raw/init_config().();
255 }
256 rawrust-analyzer cargo rust-apt 0.8.0 config/raw/::init_systemrust-analyzer cargo rust-apt 0.8.0 config/raw/init_system().();
257 }
258
259 #[cxxrust-analyzer cargo cxx 1.0.199 crate/::bridgerust-analyzer cargo cxxbridge-macro 1.0.199 bridge:]
260 pub(craterust-analyzer cargo rust-apt 0.8.0 crate/) mod rawrust-analyzer cargo rust-apt 0.8.0 config/raw/ {
261 unsafe extern "C++" {
262 includerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include!!("rust-apt/apt-pkg-c/configuration.h");
263
264 type ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#;
265
266 /// init the system. This must occur before creating the cache.
267 pub fn init_systemrust-analyzer cargo rust-apt 0.8.0 config/raw/init_system().();
268
269 /// init the config. This must occur before creating the cache.
270 pub fn init_configrust-analyzer cargo rust-apt 0.8.0 config/raw/init_config().();
271
272 /// Returns a string dump of configuration options separated by `\n`
273 pub fn dumprust-analyzer cargo rust-apt 0.8.0 config/raw/dump().() -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
274
275 /// Find a key and return it's value as a string.
276 pub fn findrust-analyzer cargo rust-apt 0.8.0 config/raw/find().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, default_value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
277
278 /// Find a file and return it's value as a string.
279 pub fn find_filerust-analyzer cargo rust-apt 0.8.0 config/raw/find_file().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, default_value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
280
281 /// Find a directory and return it's value as a string.
282 pub fn find_dirrust-analyzer cargo rust-apt 0.8.0 config/raw/find_dir().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, default_value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
283
284 /// Same as find, but for boolean values.
285 pub fn find_boolrust-analyzer cargo rust-apt 0.8.0 config/raw/find_bool().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, default_value: bool) -> bool;
286
287 /// Same as find, but for i32 values.
288 pub fn find_intrust-analyzer cargo rust-apt 0.8.0 config/raw/find_int().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, default_value: i32) -> i32;
289
290 /// Return a vector for an Apt configuration list.
291 pub fn find_vectorrust-analyzer cargo rust-apt 0.8.0 config/raw/find_vector().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>;
292
293 /// Return a vector of supported architectures on this system.
294 /// The main architecture is the first in the list.
295 pub fn get_architecturesrust-analyzer cargo rust-apt 0.8.0 config/raw/get_architectures().() -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>;
296
297 /// Set the given key to the specified value.
298 pub fn setrust-analyzer cargo rust-apt 0.8.0 config/raw/set().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
299
300 /// Simply check if a key exists.
301 pub fn existsrust-analyzer cargo rust-apt 0.8.0 config/raw/exists().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> bool;
302
303 /// Clears all values from a key.
304 ///
305 /// If the value is a list, the entire list is cleared.
306 /// If you need to clear 1 value from a list see `clear_value`
307 pub fn clearrust-analyzer cargo rust-apt 0.8.0 config/raw/clear().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
308
309 /// Clears all configuratations.
310 pub fn clear_allrust-analyzer cargo rust-apt 0.8.0 config/raw/clear_all().();
311
312 /// Clear a single value from a list.
313 /// Used for removing one item in an apt configuruation list
314 pub fn clear_valuerust-analyzer cargo rust-apt 0.8.0 config/raw/clear_value().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
315
316 unsafe fn treerust-analyzer cargo rust-apt 0.8.0 config/raw/tree().(key: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>;
317 unsafe fn root_treerust-analyzer cargo rust-apt 0.8.0 config/raw/root_tree().() -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>;
318
319 pub fn endrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]end().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> bool;
320 unsafe fn raw_nextrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]raw_next().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>;
321 unsafe fn uniquerust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]unique().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>;
322
323 unsafe fn parentrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]parent().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>;
324 unsafe fn childrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]child().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> UniquePtrrust-analyzer cargo cxx 1.0.199 unique_ptr/UniquePtr#<ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#>;
325 pub fn tagrust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]tag().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
326 pub fn valuerust-analyzer cargo rust-apt 0.8.0 config/raw/impl#[ConfigTree]value().(self: &ConfigTreerust-analyzer cargo rust-apt 0.8.0 config/raw/ConfigTree#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
327 }
328 }