mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 04:58: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)]
|
||||
pub struct Source {
|
||||
source_type: CompactString,
|
||||
source_type: SourceType,
|
||||
url: Url,
|
||||
}
|
||||
|
||||
|
@ -60,15 +67,15 @@ impl From<super::Source> for Source {
|
|||
|
||||
match src {
|
||||
Git(url) => Source {
|
||||
source_type: "Git".into(),
|
||||
source_type: SourceType::Git,
|
||||
url,
|
||||
},
|
||||
Path(url) => Source {
|
||||
source_type: "Path".into(),
|
||||
source_type: SourceType::Path,
|
||||
url,
|
||||
},
|
||||
Registry(url) => Source {
|
||||
source_type: "Registry".into(),
|
||||
source_type: SourceType::Registry,
|
||||
url,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue