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
use serde_derive::Deserialize;
use std::io::Read;
pub struct TmplBuilder {
pub pkg_name: String,
pub pkg_type: Option<PkgType>,
pub pkg_info: Option<PkgInfo>,
pub deps: Option<Vec<String>>,
}
pub struct Template {
pub inner: String,
pub name: String,
}
impl Read for Template {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
self.inner.as_bytes().read(buf)
}
}
#[derive(Copy, Clone, Eq, Ord, PartialOrd, Hash, Debug, PartialEq)]
pub enum PkgType {
Crate,
Gem,
PerlDist,
}
#[derive(Clone, Eq, Ord, PartialOrd, Hash, Default, Debug, PartialEq)]
pub struct Dependencies {
pub host: Option<Vec<String>>,
pub make: Option<Vec<String>>,
pub run: Option<Vec<String>>,
}
#[derive(Clone, Eq, Ord, PartialOrd, Hash, Default, Debug, PartialEq)]
pub struct PkgInfo {
pub pkg_name: String,
pub version: String,
pub description: String,
pub homepage: String,
pub license: Vec<String>,
pub dependencies: Option<Dependencies>,
pub sha: String,
pub download_url: Option<String>,
}
#[derive(Debug, Deserialize)]
pub(crate) struct BuiltIns {
pub perl: Vec<BuiltInDep>,
pub ruby: Vec<BuiltInDep>,
}
#[derive(Debug, Deserialize)]
pub(crate) struct BuiltInDep {
pub name: String,
}
#[derive(Debug, Deserialize)]
pub(crate) struct CorrectedVals {
pub licenses: Vec<CorrectedLicenses>,
}
#[derive(Debug, Deserialize)]
pub(crate) struct CorrectedLicenses {
pub is: String,
pub should: String,
}