embuild 0.33.2

A build support library for embedded Rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
//!  This is an autogenerated file and includes small manual fixes
//!
//!  generated with [cargo-typify](https://github.com/oxidecomputer/typify) v0.1
//!  using command "cargo typify -B tools_schema.json"
//!  and the [tools_schema.json]( https://github.com/espressif/esp-idf/blob/master/tools/tools_schema.json ) file  
//!
//! manual adjustments:
//! - made everything pub into pub (crate)
//! - manual adding missing macos-arm64 prob to VersionInfo not included in schema -> https://github.com/espressif/esp-idf/issues/13853
//! - Switched out EnvVars with serde_json Value, cause the json schema is using a patternPropertie to "specify" the field key **sick**

#![allow(clippy::redundant_closure_call)]
#![allow(clippy::needless_lifetimes)]
#![allow(clippy::match_single_binding)]
#![allow(clippy::clone_on_copy)]
#![allow(clippy::to_string_trait_impl)]

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[doc = r" Error types."]
pub(crate) mod error {
    #[doc = r" Error from a TryFrom or FromStr implementation."]
    pub(crate) struct ConversionError(std::borrow::Cow<'static, str>);
    impl std::error::Error for ConversionError {}
    impl std::fmt::Display for ConversionError {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
            std::fmt::Display::fmt(&self.0, f)
        }
    }
    impl std::fmt::Debug for ConversionError {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
            std::fmt::Debug::fmt(&self.0, f)
        }
    }
    impl From<&'static str> for ConversionError {
        fn from(value: &'static str) -> Self {
            Self(value.into())
        }
    }
    impl From<String> for ConversionError {
        fn from(value: String) -> Self {
            Self(value.into())
        }
    }
}
#[doc = "Array of strings. Used to represent paths (split into components) and command lines (split into arguments)"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Array of strings. Used to represent paths (split into components) and command lines (split into arguments)\","]
#[doc = "  \"type\": \"array\","]
#[doc = "  \"items\": {"]
#[doc = "    \"type\": \"string\""]
#[doc = "  }"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct ArrayOfStrings(pub(crate) Vec<String>);
impl std::ops::Deref for ArrayOfStrings {
    type Target = Vec<String>;
    fn deref(&self) -> &Vec<String> {
        &self.0
    }
}
impl From<ArrayOfStrings> for Vec<String> {
    fn from(value: ArrayOfStrings) -> Self {
        value.0
    }
}
impl From<&ArrayOfStrings> for ArrayOfStrings {
    fn from(value: &ArrayOfStrings) -> Self {
        value.clone()
    }
}
impl From<Vec<String>> for ArrayOfStrings {
    fn from(value: Vec<String>) -> Self {
        Self(value)
    }
}
#[doc = "Collection of environment variables. Keys and values are the environment variable names and values, respectively."]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Collection of environment variables. Keys and values are the environment variable names and values, respectively.\","]
#[doc = "  \"type\": \"object\","]
#[doc = "  \"patternProperties\": {"]
#[doc = "    \"^([A-Z_0-9]+)+$\": {"]
#[doc = "      \"type\": \"string\""]
#[doc = "    }"]
#[doc = "  },"]
#[doc = "  \"additionalProperties\": false"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
//#[serde(deny_unknown_fields)]
pub(crate) struct EnvVars(pub(crate) HashMap<String, String>);
impl From<EnvVars> for HashMap<String, String> {
    fn from(value: EnvVars) -> Self {
        value.0
    }
}
impl From<&EnvVars> for EnvVars {
    fn from(value: &EnvVars) -> Self {
        value.clone()
    }
}
impl From<HashMap<String, String>> for EnvVars {
    fn from(value: HashMap<String, String>) -> Self {
        Self(value)
    }
}
#[doc = "Array of paths to be exported (added to PATH). Each item in the array is relative to the directory where the tool will be installed."]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Array of paths to be exported (added to PATH). Each item in the array is relative to the directory where the tool will be installed.\","]
#[doc = "  \"type\": \"array\","]
#[doc = "  \"items\": {"]
#[doc = "    \"$ref\": \"#/definitions/arrayOfStrings\""]
#[doc = "  }"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct ExportPaths(pub(crate) Vec<ArrayOfStrings>);
impl std::ops::Deref for ExportPaths {
    type Target = Vec<ArrayOfStrings>;
    fn deref(&self) -> &Vec<ArrayOfStrings> {
        &self.0
    }
}
impl From<ExportPaths> for Vec<ArrayOfStrings> {
    fn from(value: ExportPaths) -> Self {
        value.0
    }
}
impl From<&ExportPaths> for ExportPaths {
    fn from(value: &ExportPaths) -> Self {
        value.clone()
    }
}
impl From<Vec<ArrayOfStrings>> for ExportPaths {
    fn from(value: Vec<ArrayOfStrings>) -> Self {
        Self(value)
    }
}
#[doc = "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation."]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation.\","]
#[doc = "  \"type\": \"string\","]
#[doc = "  \"enum\": ["]
#[doc = "    \"always\","]
#[doc = "    \"on_request\","]
#[doc = "    \"never\""]
#[doc = "  ]"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub(crate) enum InstallRequirementInfo {
    #[serde(rename = "always")]
    Always,
    #[serde(rename = "on_request")]
    OnRequest,
    #[serde(rename = "never")]
    Never,
}
impl From<&InstallRequirementInfo> for InstallRequirementInfo {
    fn from(value: &InstallRequirementInfo) -> Self {
        value.clone()
    }
}
impl ToString for InstallRequirementInfo {
    fn to_string(&self) -> String {
        match *self {
            Self::Always => "always".to_string(),
            Self::OnRequest => "on_request".to_string(),
            Self::Never => "never".to_string(),
        }
    }
}
impl std::str::FromStr for InstallRequirementInfo {
    type Err = self::error::ConversionError;
    fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
        match value {
            "always" => Ok(Self::Always),
            "on_request" => Ok(Self::OnRequest),
            "never" => Ok(Self::Never),
            _ => Err("invalid value".into()),
        }
    }
}
impl std::convert::TryFrom<&str> for InstallRequirementInfo {
    type Error = self::error::ConversionError;
    fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl std::convert::TryFrom<&String> for InstallRequirementInfo {
    type Error = self::error::ConversionError;
    fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl std::convert::TryFrom<String> for InstallRequirementInfo {
    type Error = self::error::ConversionError;
    fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
#[doc = "Information about download artifact for one platform"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Information about download artifact for one platform\","]
#[doc = "  \"type\": \"object\","]
#[doc = "  \"required\": ["]
#[doc = "    \"sha256\","]
#[doc = "    \"size\","]
#[doc = "    \"url\""]
#[doc = "  ],"]
#[doc = "  \"properties\": {"]
#[doc = "    \"rename_dist\": {"]
#[doc = "      \"description\": \"Filename under which the archive should be downloaded\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"sha256\": {"]
#[doc = "      \"description\": \"SHA256 sum of the file\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"size\": {"]
#[doc = "      \"description\": \"Size of the file, in bytes\","]
#[doc = "      \"type\": \"integer\""]
#[doc = "    },"]
#[doc = "    \"url\": {"]
#[doc = "      \"description\": \"Download URL\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    }"]
#[doc = "  }"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct PlatformDownloadInfo {
    #[doc = "Filename under which the archive should be downloaded"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) rename_dist: Option<String>,
    #[doc = "SHA256 sum of the file"]
    pub(crate) sha256: String,
    #[doc = "Size of the file, in bytes"]
    pub(crate) size: i64,
    #[doc = "Download URL"]
    pub(crate) url: String,
}
impl From<&PlatformDownloadInfo> for PlatformDownloadInfo {
    fn from(value: &PlatformDownloadInfo) -> Self {
        value.clone()
    }
}
#[doc = "Platform-specific values which override the defaults"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Platform-specific values which override the defaults\","]
#[doc = "  \"type\": \"object\","]
#[doc = "  \"required\": ["]
#[doc = "    \"platforms\""]
#[doc = "  ],"]
#[doc = "  \"properties\": {"]
#[doc = "    \"export_paths\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/export_paths\","]
#[doc = "      \"$ref\": \"#/definitions/exportPaths\""]
#[doc = "    },"]
#[doc = "    \"export_vars\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/export_vars\","]
#[doc = "      \"$ref\": \"#/definitions/envVars\""]
#[doc = "    },"]
#[doc = "    \"install\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/install\","]
#[doc = "      \"$ref\": \"#/definitions/installRequirementInfo\""]
#[doc = "    },"]
#[doc = "    \"platforms\": {"]
#[doc = "      \"description\": \"List of platforms to which this override applies\","]
#[doc = "      \"type\": \"array\","]
#[doc = "      \"items\": {"]
#[doc = "        \"type\": \"string\","]
#[doc = "        \"enum\": ["]
#[doc = "          \"linux-i686\","]
#[doc = "          \"linux-amd64\","]
#[doc = "          \"linux-armel\","]
#[doc = "          \"linux-arm64\","]
#[doc = "          \"macos\","]
#[doc = "          \"macos-arm64\","]
#[doc = "          \"win32\","]
#[doc = "          \"win64\""]
#[doc = "        ]"]
#[doc = "      }"]
#[doc = "    },"]
#[doc = "    \"strip_container_dirs\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/strip_container_dirs\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"supported_targets\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/supported_targets\","]
#[doc = "      \"$ref\": \"#/definitions/arrayOfStrings\""]
#[doc = "    },"]
#[doc = "    \"version_cmd\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/version_cmd\","]
#[doc = "      \"$ref\": \"#/definitions/arrayOfStrings\""]
#[doc = "    },"]
#[doc = "    \"version_regex\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/version_regex\","]
#[doc = "      \"$ref\": \"#/definitions/regex\""]
#[doc = "    },"]
#[doc = "    \"version_regex_replace\": {"]
#[doc = "      \"description\": \"Platform-specific replacement for toolInfo/version_regex_replace\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    }"]
#[doc = "  }"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct PlatformOverrideInfo {
    #[doc = "Platform-specific replacement for toolInfo/export_paths"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) export_paths: Option<ExportPaths>,
    #[doc = "Platform-specific replacement for toolInfo/export_vars"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) export_vars: Option<EnvVars>,
    #[doc = "Platform-specific replacement for toolInfo/install"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) install: Option<InstallRequirementInfo>,
    #[doc = "List of platforms to which this override applies"]
    pub(crate) platforms: Vec<PlatformOverrideInfoPlatformsItem>,
    #[doc = "Platform-specific replacement for toolInfo/strip_container_dirs"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) strip_container_dirs: Option<String>,
    #[doc = "Platform-specific replacement for toolInfo/supported_targets"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) supported_targets: Option<ArrayOfStrings>,
    #[doc = "Platform-specific replacement for toolInfo/version_cmd"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) version_cmd: Option<ArrayOfStrings>,
    #[doc = "Platform-specific replacement for toolInfo/version_regex"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) version_regex: Option<Regex>,
    #[doc = "Platform-specific replacement for toolInfo/version_regex_replace"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) version_regex_replace: Option<String>,
}
impl From<&PlatformOverrideInfo> for PlatformOverrideInfo {
    fn from(value: &PlatformOverrideInfo) -> Self {
        value.clone()
    }
}
#[doc = "PlatformOverrideInfoPlatformsItem"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"type\": \"string\","]
#[doc = "  \"enum\": ["]
#[doc = "    \"linux-i686\","]
#[doc = "    \"linux-amd64\","]
#[doc = "    \"linux-armel\","]
#[doc = "    \"linux-arm64\","]
#[doc = "    \"macos\","]
#[doc = "    \"macos-arm64\","]
#[doc = "    \"win32\","]
#[doc = "    \"win64\""]
#[doc = "  ]"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub(crate) enum PlatformOverrideInfoPlatformsItem {
    #[serde(rename = "linux-i686")]
    LinuxI686,
    #[serde(rename = "linux-amd64")]
    LinuxAmd64,
    #[serde(rename = "linux-armel")]
    LinuxArmel,
    #[serde(rename = "linux-arm64")]
    LinuxArm64,
    #[serde(rename = "macos")]
    Macos,
    #[serde(rename = "macos-arm64")]
    MacosArm64,
    #[serde(rename = "win32")]
    Win32,
    #[serde(rename = "win64")]
    Win64,
    #[serde(rename = "win-arm64")]
    WinArm64,
}
impl From<&PlatformOverrideInfoPlatformsItem> for PlatformOverrideInfoPlatformsItem {
    fn from(value: &PlatformOverrideInfoPlatformsItem) -> Self {
        value.clone()
    }
}
impl ToString for PlatformOverrideInfoPlatformsItem {
    fn to_string(&self) -> String {
        match *self {
            Self::LinuxI686 => "linux-i686".to_string(),
            Self::LinuxAmd64 => "linux-amd64".to_string(),
            Self::LinuxArmel => "linux-armel".to_string(),
            Self::LinuxArm64 => "linux-arm64".to_string(),
            Self::Macos => "macos".to_string(),
            Self::MacosArm64 => "macos-arm64".to_string(),
            Self::Win32 => "win32".to_string(),
            Self::Win64 => "win64".to_string(),
            Self::WinArm64 => "win-arm64".to_string(),
        }
    }
}
impl std::str::FromStr for PlatformOverrideInfoPlatformsItem {
    type Err = self::error::ConversionError;
    fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
        match value {
            "linux-i686" => Ok(Self::LinuxI686),
            "linux-amd64" => Ok(Self::LinuxAmd64),
            "linux-armel" => Ok(Self::LinuxArmel),
            "linux-arm64" => Ok(Self::LinuxArm64),
            "macos" => Ok(Self::Macos),
            "macos-arm64" => Ok(Self::MacosArm64),
            "win32" => Ok(Self::Win32),
            "win64" => Ok(Self::Win64),
            "win-arm64" => Ok(Self::WinArm64),
            _ => Err("invalid value".into()),
        }
    }
}
impl std::convert::TryFrom<&str> for PlatformOverrideInfoPlatformsItem {
    type Error = self::error::ConversionError;
    fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl std::convert::TryFrom<&String> for PlatformOverrideInfoPlatformsItem {
    type Error = self::error::ConversionError;
    fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl std::convert::TryFrom<String> for PlatformOverrideInfoPlatformsItem {
    type Error = self::error::ConversionError;
    fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
#[doc = "A regular expression"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"A regular expression\","]
#[doc = "  \"type\": \"string\""]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub(crate) struct Regex(pub(crate) String);
impl std::ops::Deref for Regex {
    type Target = String;
    fn deref(&self) -> &String {
        &self.0
    }
}
impl From<Regex> for String {
    fn from(value: Regex) -> Self {
        value.0
    }
}
impl From<&Regex> for Regex {
    fn from(value: &Regex) -> Self {
        value.clone()
    }
}
impl From<String> for Regex {
    fn from(value: String) -> Self {
        Self(value)
    }
}
impl std::str::FromStr for Regex {
    type Err = std::convert::Infallible;
    fn from_str(value: &str) -> Result<Self, Self::Err> {
        Ok(Self(value.to_string()))
    }
}
impl ToString for Regex {
    fn to_string(&self) -> String {
        self.0.to_string()
    }
}
#[doc = "Information about one tool"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Information about one tool\","]
#[doc = "  \"type\": \"object\","]
#[doc = "  \"required\": ["]
#[doc = "    \"description\","]
#[doc = "    \"export_paths\","]
#[doc = "    \"info_url\","]
#[doc = "    \"install\","]
#[doc = "    \"license\","]
#[doc = "    \"version_cmd\","]
#[doc = "    \"version_regex\","]
#[doc = "    \"versions\""]
#[doc = "  ],"]
#[doc = "  \"properties\": {"]
#[doc = "    \"description\": {"]
#[doc = "      \"description\": \"A short (one sentence) description of the tool.\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"export_paths\": {"]
#[doc = "      \"$ref\": \"#/definitions/exportPaths\""]
#[doc = "    },"]
#[doc = "    \"export_vars\": {"]
#[doc = "      \"description\": \"Some variable expansions are done on the values. 1) ${TOOL_PATH} is replaced with the directory where the tool is installed.\","]
#[doc = "      \"$ref\": \"#/definitions/envVars\""]
#[doc = "    },"]
#[doc = "    \"info_url\": {"]
#[doc = "      \"description\": \"URL of the page with information about the tool\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"install\": {"]
#[doc = "      \"description\": \"If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation.\","]
#[doc = "      \"$ref\": \"#/definitions/installRequirementInfo\""]
#[doc = "    },"]
#[doc = "    \"is_executable\": {"]
#[doc = "      \"description\": \"If false - tool does not contain executables. The version will not be checked but export_vars applied.\","]
#[doc = "      \"type\": \"boolean\""]
#[doc = "    },"]
#[doc = "    \"license\": {"]
#[doc = "      \"description\": \"License name. Use SPDX license identifier if it exists, short name of the license otherwise.\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"name\": {"]
#[doc = "      \"description\": \"Tool name (used as a directory name)\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"platform_overrides\": {"]
#[doc = "      \"description\": \"List of platform-specific overrides\","]
#[doc = "      \"type\": \"array\","]
#[doc = "      \"items\": {"]
#[doc = "        \"$ref\": \"#/definitions/platformOverrideInfo\""]
#[doc = "      }"]
#[doc = "    },"]
#[doc = "    \"strip_container_dirs\": {"]
#[doc = "      \"description\": \"If specified, this number of top directory levels will removed when extracting. E.g. if strip_container_dirs=2, archive path a/b/c/d.txt will be extracted as c/d.txt\","]
#[doc = "      \"type\": \"integer\""]
#[doc = "    },"]
#[doc = "    \"supported_targets\": {"]
#[doc = "      \"description\": \"Array of esp_targets that this tool is needed for.\","]
#[doc = "      \"$ref\": \"#/definitions/arrayOfStrings\""]
#[doc = "    },"]
#[doc = "    \"version_cmd\": {"]
#[doc = "      \"description\": \"Command to be executed (along with any extra arguments). The executable be present in one of the export_paths.\","]
#[doc = "      \"$ref\": \"#/definitions/arrayOfStrings\""]
#[doc = "    },"]
#[doc = "    \"version_regex\": {"]
#[doc = "      \"description\": \"Regex which is to be applied to version_cmd output to extract the version. By default, the version will be the first capture group of the expression. If version_regex_replace is specified, version will be obtained by doing a substitution using version_regex_replace instead.\","]
#[doc = "      \"$ref\": \"#/definitions/regex\""]
#[doc = "    },"]
#[doc = "    \"version_regex_replace\": {"]
#[doc = "      \"description\": \"If given, this will be used as substitute expression for the regex defined in version_regex, to obtain the version string. Not specifying this is equivalent to setting it to '\\\\1' (i.e. return the first capture group).\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"versions\": {"]
#[doc = "      \"description\": \"List of versions\","]
#[doc = "      \"type\": \"array\","]
#[doc = "      \"items\": {"]
#[doc = "        \"$ref\": \"#/definitions/versionInfo\""]
#[doc = "      }"]
#[doc = "    }"]
#[doc = "  }"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct ToolInfo {
    #[doc = "A short (one sentence) description of the tool."]
    pub(crate) description: String,
    pub(crate) export_paths: ExportPaths,
    #[doc = "Some variable expansions are done on the values. 1) ${TOOL_PATH} is replaced with the directory where the tool is installed."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) export_vars: Option<EnvVars>,
    #[doc = "URL of the page with information about the tool"]
    pub(crate) info_url: String,
    #[doc = "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation."]
    pub(crate) install: InstallRequirementInfo,
    #[doc = "If false - tool does not contain executables. The version will not be checked but export_vars applied."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) is_executable: Option<bool>,
    #[doc = "License name. Use SPDX license identifier if it exists, short name of the license otherwise."]
    pub(crate) license: String,
    #[doc = "Tool name (used as a directory name)"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) name: Option<String>,
    #[doc = "List of platform-specific overrides"]
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub(crate) platform_overrides: Vec<PlatformOverrideInfo>,
    #[doc = "If specified, this number of top directory levels will removed when extracting. E.g. if strip_container_dirs=2, archive path a/b/c/d.txt will be extracted as c/d.txt"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) strip_container_dirs: Option<i64>,
    #[doc = "Array of esp_targets that this tool is needed for."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) supported_targets: Option<ArrayOfStrings>,
    #[doc = "Command to be executed (along with any extra arguments). The executable be present in one of the export_paths."]
    pub(crate) version_cmd: ArrayOfStrings,
    #[doc = "Regex which is to be applied to version_cmd output to extract the version. By default, the version will be the first capture group of the expression. If version_regex_replace is specified, version will be obtained by doing a substitution using version_regex_replace instead."]
    pub(crate) version_regex: Regex,
    #[doc = "If given, this will be used as substitute expression for the regex defined in version_regex, to obtain the version string. Not specifying this is equivalent to setting it to '\\1' (i.e. return the first capture group)."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) version_regex_replace: Option<String>,
    #[doc = "List of versions"]
    pub(crate) versions: Vec<VersionInfo>,
}
impl From<&ToolInfo> for ToolInfo {
    fn from(value: &ToolInfo) -> Self {
        value.clone()
    }
}
#[doc = "VersionInfo"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"type\": \"object\","]
#[doc = "  \"properties\": {"]
#[doc = "    \"any\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"linux-amd64\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"linux-arm64\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"linux-armel\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"linux-i686\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"macos\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"name\": {"]
#[doc = "      \"description\": \"Version name (used as a directory name)\","]
#[doc = "      \"type\": \"string\""]
#[doc = "    },"]
#[doc = "    \"status\": {"]
#[doc = "      \"description\": \"Determines whether the version is recommended/supported/deprecated\","]
#[doc = "      \"type\": \"string\","]
#[doc = "      \"enum\": ["]
#[doc = "        \"recommended\","]
#[doc = "        \"supported\","]
#[doc = "        \"deprecated\""]
#[doc = "      ]"]
#[doc = "    },"]
#[doc = "    \"win32\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    },"]
#[doc = "    \"win64\": {"]
#[doc = "      \"$ref\": \"#/definitions/platformDownloadInfo\""]
#[doc = "    }"]
#[doc = "  }"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub(crate) struct VersionInfo {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) any: Option<PlatformDownloadInfo>,
    #[serde(
        rename = "linux-amd64",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub(crate) linux_amd64: Option<PlatformDownloadInfo>,
    #[serde(
        rename = "linux-arm64",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub(crate) linux_arm64: Option<PlatformDownloadInfo>,
    #[serde(
        rename = "linux-armel",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub(crate) linux_armel: Option<PlatformDownloadInfo>,
    #[serde(
        rename = "linux-i686",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub(crate) linux_i686: Option<PlatformDownloadInfo>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) macos: Option<PlatformDownloadInfo>,
    #[serde(
        rename = "macos-arm64",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub(crate) macos_arm64: Option<PlatformDownloadInfo>,
    #[doc = "Version name (used as a directory name)"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) name: Option<String>,
    #[doc = "Determines whether the version is recommended/supported/deprecated"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) status: Option<VersionInfoStatus>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) win32: Option<PlatformDownloadInfo>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub(crate) win64: Option<PlatformDownloadInfo>,
    #[serde(rename = "win-arm64", default, skip_serializing_if = "Option::is_none")]
    pub(crate) win_arm64: Option<PlatformDownloadInfo>,
}
impl From<&VersionInfo> for VersionInfo {
    fn from(value: &VersionInfo) -> Self {
        value.clone()
    }
}
#[doc = "Determines whether the version is recommended/supported/deprecated"]
#[doc = r""]
#[doc = r" <details><summary>JSON schema</summary>"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
#[doc = "  \"description\": \"Determines whether the version is recommended/supported/deprecated\","]
#[doc = "  \"type\": \"string\","]
#[doc = "  \"enum\": ["]
#[doc = "    \"recommended\","]
#[doc = "    \"supported\","]
#[doc = "    \"deprecated\""]
#[doc = "  ]"]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" </details>"]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub(crate) enum VersionInfoStatus {
    #[serde(rename = "recommended")]
    Recommended,
    #[serde(rename = "supported")]
    Supported,
    #[serde(rename = "deprecated")]
    Deprecated,
}
impl From<&VersionInfoStatus> for VersionInfoStatus {
    fn from(value: &VersionInfoStatus) -> Self {
        value.clone()
    }
}
impl ToString for VersionInfoStatus {
    fn to_string(&self) -> String {
        match *self {
            Self::Recommended => "recommended".to_string(),
            Self::Supported => "supported".to_string(),
            Self::Deprecated => "deprecated".to_string(),
        }
    }
}
impl std::str::FromStr for VersionInfoStatus {
    type Err = self::error::ConversionError;
    fn from_str(value: &str) -> Result<Self, self::error::ConversionError> {
        match value {
            "recommended" => Ok(Self::Recommended),
            "supported" => Ok(Self::Supported),
            "deprecated" => Ok(Self::Deprecated),
            _ => Err("invalid value".into()),
        }
    }
}
impl std::convert::TryFrom<&str> for VersionInfoStatus {
    type Error = self::error::ConversionError;
    fn try_from(value: &str) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl std::convert::TryFrom<&String> for VersionInfoStatus {
    type Error = self::error::ConversionError;
    fn try_from(value: &String) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl std::convert::TryFrom<String> for VersionInfoStatus {
    type Error = self::error::ConversionError;
    fn try_from(value: String) -> Result<Self, self::error::ConversionError> {
        value.parse()
    }
}