mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
Add new enum binstall_v1::SourceType
Use it to represent source type instead of using `CompactString`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
cbd64b039d
commit
5ca1278c22
1 changed files with 11 additions and 4 deletions
|
@ -48,9 +48,16 @@ impl MetaData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||||
|
enum SourceType {
|
||||||
|
Git,
|
||||||
|
Path,
|
||||||
|
Registry,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Source {
|
pub struct Source {
|
||||||
source_type: CompactString,
|
source_type: SourceType,
|
||||||
url: Url,
|
url: Url,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,15 +67,15 @@ impl From<super::Source> for Source {
|
||||||
|
|
||||||
match src {
|
match src {
|
||||||
Git(url) => Source {
|
Git(url) => Source {
|
||||||
source_type: "Git".into(),
|
source_type: SourceType::Git,
|
||||||
url,
|
url,
|
||||||
},
|
},
|
||||||
Path(url) => Source {
|
Path(url) => Source {
|
||||||
source_type: "Path".into(),
|
source_type: SourceType::Path,
|
||||||
url,
|
url,
|
||||||
},
|
},
|
||||||
Registry(url) => Source {
|
Registry(url) => Source {
|
||||||
source_type: "Registry".into(),
|
source_type: SourceType::Registry,
|
||||||
url,
|
url,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue