| 1 |
// SPDX-License-Identifier: Apache-2.0 OR MIT |
| 2 |
// This file is @generated by cargo-config2-internal-codegen |
| 3 |
// (gen_de function at tools/codegen/src/main.rs). |
| 4 |
// It is not intended for manual editing. |
| 5 |
|
| 6 |
#![cfg_attr(rustfmt, rustfmt::skip)] |
| 7 |
use std::path::Path; |
| 8 |
use crate::{error::Result, merge::Merge, value::SetPath}; |
| 9 |
impl Merge for crate::de::Config { |
| 10 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 11 |
Merge::merge(&mut self.alias, low.alias, force)?; |
| 12 |
Merge::merge(&mut self.build, low.build, force)?; |
| 13 |
Merge::merge(&mut self.credential_alias, low.credential_alias, force)?; |
| 14 |
Merge::merge(&mut self.doc, low.doc, force)?; |
| 15 |
Merge::merge(&mut self.env, low.env, force)?; |
| 16 |
Merge::merge( |
| 17 |
&mut self.future_incompat_report, |
| 18 |
low.future_incompat_report, |
| 19 |
force, |
| 20 |
)?; |
| 21 |
Merge::merge(&mut self.cargo_new, low.cargo_new, force)?; |
| 22 |
Merge::merge(&mut self.http, low.http, force)?; |
| 23 |
Merge::merge(&mut self.net, low.net, force)?; |
| 24 |
Merge::merge(&mut self.registries, low.registries, force)?; |
| 25 |
Merge::merge(&mut self.registry, low.registry, force)?; |
| 26 |
Merge::merge(&mut self.source, low.source, force)?; |
| 27 |
Merge::merge(&mut self.target, low.target, force)?; |
| 28 |
Merge::merge(&mut self.term, low.term, force)?; |
| 29 |
Ok(()) |
| 30 |
} |
| 31 |
} |
| 32 |
impl SetPath for crate::de::Config { |
| 33 |
fn set_path(&mut self, path: &Path) { |
| 34 |
self.alias.set_path(path); |
| 35 |
self.build.set_path(path); |
| 36 |
self.credential_alias.set_path(path); |
| 37 |
self.doc.set_path(path); |
| 38 |
self.env.set_path(path); |
| 39 |
self.future_incompat_report.set_path(path); |
| 40 |
self.cargo_new.set_path(path); |
| 41 |
self.http.set_path(path); |
| 42 |
self.net.set_path(path); |
| 43 |
self.registries.set_path(path); |
| 44 |
self.registry.set_path(path); |
| 45 |
self.source.set_path(path); |
| 46 |
self.target.set_path(path); |
| 47 |
self.term.set_path(path); |
| 48 |
} |
| 49 |
} |
| 50 |
impl Merge for crate::de::BuildConfig { |
| 51 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 52 |
Merge::merge(&mut self.jobs, low.jobs, force)?; |
| 53 |
Merge::merge(&mut self.rustc, low.rustc, force)?; |
| 54 |
Merge::merge(&mut self.rustc_wrapper, low.rustc_wrapper, force)?; |
| 55 |
Merge::merge( |
| 56 |
&mut self.rustc_workspace_wrapper, |
| 57 |
low.rustc_workspace_wrapper, |
| 58 |
force, |
| 59 |
)?; |
| 60 |
Merge::merge(&mut self.rustdoc, low.rustdoc, force)?; |
| 61 |
Merge::merge(&mut self.target, low.target, force)?; |
| 62 |
Merge::merge(&mut self.target_dir, low.target_dir, force)?; |
| 63 |
Merge::merge(&mut self.build_dir, low.build_dir, force)?; |
| 64 |
Merge::merge(&mut self.rustflags, low.rustflags, force)?; |
| 65 |
Merge::merge(&mut self.rustdocflags, low.rustdocflags, force)?; |
| 66 |
Merge::merge(&mut self.incremental, low.incremental, force)?; |
| 67 |
Merge::merge(&mut self.dep_info_basedir, low.dep_info_basedir, force)?; |
| 68 |
Ok(()) |
| 69 |
} |
| 70 |
} |
| 71 |
impl SetPath for crate::de::BuildConfig { |
| 72 |
fn set_path(&mut self, path: &Path) { |
| 73 |
self.jobs.set_path(path); |
| 74 |
self.rustc.set_path(path); |
| 75 |
self.rustc_wrapper.set_path(path); |
| 76 |
self.rustc_workspace_wrapper.set_path(path); |
| 77 |
self.rustdoc.set_path(path); |
| 78 |
self.target.set_path(path); |
| 79 |
self.target_dir.set_path(path); |
| 80 |
self.build_dir.set_path(path); |
| 81 |
self.rustflags.set_path(path); |
| 82 |
self.rustdocflags.set_path(path); |
| 83 |
self.incremental.set_path(path); |
| 84 |
self.dep_info_basedir.set_path(path); |
| 85 |
} |
| 86 |
} |
| 87 |
impl Merge for crate::de::TargetConfig { |
| 88 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 89 |
Merge::merge(&mut self.linker, low.linker, force)?; |
| 90 |
Merge::merge(&mut self.runner, low.runner, force)?; |
| 91 |
Merge::merge(&mut self.rustflags, low.rustflags, force)?; |
| 92 |
Merge::merge(&mut self.rustdocflags, low.rustdocflags, force)?; |
| 93 |
Merge::merge(&mut self.rest, low.rest, force)?; |
| 94 |
Ok(()) |
| 95 |
} |
| 96 |
} |
| 97 |
impl SetPath for crate::de::TargetConfig { |
| 98 |
fn set_path(&mut self, path: &Path) { |
| 99 |
self.linker.set_path(path); |
| 100 |
self.runner.set_path(path); |
| 101 |
self.rustflags.set_path(path); |
| 102 |
self.rustdocflags.set_path(path); |
| 103 |
self.rest.set_path(path); |
| 104 |
} |
| 105 |
} |
| 106 |
impl Merge for crate::de::DocConfig { |
| 107 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 108 |
Merge::merge(&mut self.browser, low.browser, force)?; |
| 109 |
Ok(()) |
| 110 |
} |
| 111 |
} |
| 112 |
impl SetPath for crate::de::DocConfig { |
| 113 |
fn set_path(&mut self, path: &Path) { |
| 114 |
self.browser.set_path(path); |
| 115 |
} |
| 116 |
} |
| 117 |
impl SetPath for crate::de::EnvConfigValue { |
| 118 |
fn set_path(&mut self, path: &Path) { |
| 119 |
match self { |
| 120 |
Self::Value(v) => { |
| 121 |
v.set_path(path); |
| 122 |
} |
| 123 |
Self::Table { value, force, relative } => { |
| 124 |
value.set_path(path); |
| 125 |
force.set_path(path); |
| 126 |
relative.set_path(path); |
| 127 |
} |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
impl Merge for crate::de::FutureIncompatReportConfig { |
| 132 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 133 |
Merge::merge(&mut self.frequency, low.frequency, force)?; |
| 134 |
Ok(()) |
| 135 |
} |
| 136 |
} |
| 137 |
impl SetPath for crate::de::FutureIncompatReportConfig { |
| 138 |
fn set_path(&mut self, path: &Path) { |
| 139 |
self.frequency.set_path(path); |
| 140 |
} |
| 141 |
} |
| 142 |
impl Merge for crate::de::CargoNewConfig { |
| 143 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 144 |
Merge::merge(&mut self.vcs, low.vcs, force)?; |
| 145 |
Ok(()) |
| 146 |
} |
| 147 |
} |
| 148 |
impl SetPath for crate::de::CargoNewConfig { |
| 149 |
fn set_path(&mut self, path: &Path) { |
| 150 |
self.vcs.set_path(path); |
| 151 |
} |
| 152 |
} |
| 153 |
impl Merge for crate::de::HttpConfig { |
| 154 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 155 |
Merge::merge(&mut self.debug, low.debug, force)?; |
| 156 |
Merge::merge(&mut self.proxy, low.proxy, force)?; |
| 157 |
Merge::merge(&mut self.timeout, low.timeout, force)?; |
| 158 |
Merge::merge(&mut self.cainfo, low.cainfo, force)?; |
| 159 |
Merge::merge(&mut self.check_revoke, low.check_revoke, force)?; |
| 160 |
Merge::merge(&mut self.low_speed_limit, low.low_speed_limit, force)?; |
| 161 |
Merge::merge(&mut self.multiplexing, low.multiplexing, force)?; |
| 162 |
Merge::merge(&mut self.user_agent, low.user_agent, force)?; |
| 163 |
Ok(()) |
| 164 |
} |
| 165 |
} |
| 166 |
impl SetPath for crate::de::HttpConfig { |
| 167 |
fn set_path(&mut self, path: &Path) { |
| 168 |
self.debug.set_path(path); |
| 169 |
self.proxy.set_path(path); |
| 170 |
self.timeout.set_path(path); |
| 171 |
self.cainfo.set_path(path); |
| 172 |
self.check_revoke.set_path(path); |
| 173 |
self.low_speed_limit.set_path(path); |
| 174 |
self.multiplexing.set_path(path); |
| 175 |
self.user_agent.set_path(path); |
| 176 |
} |
| 177 |
} |
| 178 |
impl Merge for crate::de::NetConfig { |
| 179 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 180 |
Merge::merge(&mut self.retry, low.retry, force)?; |
| 181 |
Merge::merge(&mut self.git_fetch_with_cli, low.git_fetch_with_cli, force)?; |
| 182 |
Merge::merge(&mut self.offline, low.offline, force)?; |
| 183 |
Ok(()) |
| 184 |
} |
| 185 |
} |
| 186 |
impl SetPath for crate::de::NetConfig { |
| 187 |
fn set_path(&mut self, path: &Path) { |
| 188 |
self.retry.set_path(path); |
| 189 |
self.git_fetch_with_cli.set_path(path); |
| 190 |
self.offline.set_path(path); |
| 191 |
} |
| 192 |
} |
| 193 |
impl Merge for crate::de::RegistriesConfigValue { |
| 194 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 195 |
Merge::merge(&mut self.index, low.index, force)?; |
| 196 |
Merge::merge(&mut self.token, low.token, force)?; |
| 197 |
Merge::merge(&mut self.credential_provider, low.credential_provider, force)?; |
| 198 |
Merge::merge(&mut self.protocol, low.protocol, force)?; |
| 199 |
Ok(()) |
| 200 |
} |
| 201 |
} |
| 202 |
impl SetPath for crate::de::RegistriesConfigValue { |
| 203 |
fn set_path(&mut self, path: &Path) { |
| 204 |
self.index.set_path(path); |
| 205 |
self.token.set_path(path); |
| 206 |
self.credential_provider.set_path(path); |
| 207 |
self.protocol.set_path(path); |
| 208 |
} |
| 209 |
} |
| 210 |
impl Merge for crate::de::RegistryConfig { |
| 211 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 212 |
Merge::merge(&mut self.default, low.default, force)?; |
| 213 |
Merge::merge(&mut self.credential_provider, low.credential_provider, force)?; |
| 214 |
Merge::merge(&mut self.token, low.token, force)?; |
| 215 |
Merge::merge( |
| 216 |
&mut self.global_credential_providers, |
| 217 |
low.global_credential_providers, |
| 218 |
force, |
| 219 |
)?; |
| 220 |
Ok(()) |
| 221 |
} |
| 222 |
} |
| 223 |
impl SetPath for crate::de::RegistryConfig { |
| 224 |
fn set_path(&mut self, path: &Path) { |
| 225 |
self.default.set_path(path); |
| 226 |
self.credential_provider.set_path(path); |
| 227 |
self.token.set_path(path); |
| 228 |
self.global_credential_providers.set_path(path); |
| 229 |
} |
| 230 |
} |
| 231 |
impl Merge for crate::de::SourceConfigValue { |
| 232 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 233 |
Merge::merge(&mut self.replace_with, low.replace_with, force)?; |
| 234 |
Merge::merge(&mut self.directory, low.directory, force)?; |
| 235 |
Merge::merge(&mut self.registry, low.registry, force)?; |
| 236 |
Merge::merge(&mut self.local_registry, low.local_registry, force)?; |
| 237 |
Merge::merge(&mut self.git, low.git, force)?; |
| 238 |
Merge::merge(&mut self.branch, low.branch, force)?; |
| 239 |
Merge::merge(&mut self.tag, low.tag, force)?; |
| 240 |
Merge::merge(&mut self.rev, low.rev, force)?; |
| 241 |
Ok(()) |
| 242 |
} |
| 243 |
} |
| 244 |
impl SetPath for crate::de::SourceConfigValue { |
| 245 |
fn set_path(&mut self, path: &Path) { |
| 246 |
self.replace_with.set_path(path); |
| 247 |
self.directory.set_path(path); |
| 248 |
self.registry.set_path(path); |
| 249 |
self.local_registry.set_path(path); |
| 250 |
self.git.set_path(path); |
| 251 |
self.branch.set_path(path); |
| 252 |
self.tag.set_path(path); |
| 253 |
self.rev.set_path(path); |
| 254 |
} |
| 255 |
} |
| 256 |
impl SetPath for crate::de::GlobalCredentialProviders { |
| 257 |
fn set_path(&mut self, path: &Path) { |
| 258 |
self.0.set_path(path); |
| 259 |
} |
| 260 |
} |
| 261 |
impl SetPath for crate::de::CredentialProvider { |
| 262 |
fn set_path(&mut self, path: &Path) { |
| 263 |
self.kind.set_path(path); |
| 264 |
} |
| 265 |
} |
| 266 |
impl Merge for crate::de::TermConfig { |
| 267 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 268 |
Merge::merge(&mut self.quiet, low.quiet, force)?; |
| 269 |
Merge::merge(&mut self.verbose, low.verbose, force)?; |
| 270 |
Merge::merge(&mut self.color, low.color, force)?; |
| 271 |
Merge::merge(&mut self.progress, low.progress, force)?; |
| 272 |
Ok(()) |
| 273 |
} |
| 274 |
} |
| 275 |
impl SetPath for crate::de::TermConfig { |
| 276 |
fn set_path(&mut self, path: &Path) { |
| 277 |
self.quiet.set_path(path); |
| 278 |
self.verbose.set_path(path); |
| 279 |
self.color.set_path(path); |
| 280 |
self.progress.set_path(path); |
| 281 |
} |
| 282 |
} |
| 283 |
impl Merge for crate::de::TermProgress { |
| 284 |
fn merge(&mut self, low: Self, force: bool) -> Result<()> { |
| 285 |
Merge::merge(&mut self.when, low.when, force)?; |
| 286 |
Merge::merge(&mut self.width, low.width, force)?; |
| 287 |
Ok(()) |
| 288 |
} |
| 289 |
} |
| 290 |
impl SetPath for crate::de::TermProgress { |
| 291 |
fn set_path(&mut self, path: &Path) { |
| 292 |
self.when.set_path(path); |
| 293 |
self.width.set_path(path); |
| 294 |
} |
| 295 |
} |
| 296 |
impl SetPath for crate::de::Flags { |
| 297 |
fn set_path(&mut self, path: &Path) { |
| 298 |
self.flags.set_path(path); |
| 299 |
} |
| 300 |
} |
| 301 |
impl SetPath for crate::de::ConfigRelativePath { |
| 302 |
fn set_path(&mut self, path: &Path) { |
| 303 |
self.0.set_path(path); |
| 304 |
} |
| 305 |
} |
| 306 |
impl SetPath for crate::de::PathAndArgs { |
| 307 |
fn set_path(&mut self, path: &Path) { |
| 308 |
self.path.set_path(path); |
| 309 |
self.args.set_path(path); |
| 310 |
} |
| 311 |
} |
| 312 |
impl SetPath for crate::de::StringList { |
| 313 |
fn set_path(&mut self, path: &Path) { |
| 314 |
self.list.set_path(path); |
| 315 |
} |
| 316 |
} |
| 317 |
impl SetPath for crate::de::StringOrArray { |
| 318 |
fn set_path(&mut self, path: &Path) { |
| 319 |
match self { |
| 320 |
Self::String(v) => { |
| 321 |
v.set_path(path); |
| 322 |
} |
| 323 |
Self::Array(v) => { |
| 324 |
v.set_path(path); |
| 325 |
} |
| 326 |
} |
| 327 |
} |
| 328 |
} |