Refactor: Use binstall_v1::MetaData in mod binstall

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-27 19:44:16 +10:00
parent 05c0d5fcae
commit 2f27a5fd93
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
6 changed files with 51 additions and 82 deletions

View file

@ -23,30 +23,6 @@ pub struct MetaData {
pub target: CompactString,
pub bins: Vec<CompactString>,
}
impl MetaData {
pub fn new(metadata: crate::binstall::MetaData) -> Self {
let crate::binstall::MetaData {
bins,
cvs:
super::CrateVersionSource {
name,
version,
source,
},
version_req,
target,
} = metadata;
Self {
name: name.into(),
version_req: version_req.into(),
current_version: version,
source: source.into(),
target: target.into(),
bins,
}
}
}
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub enum SourceType {
@ -70,27 +46,6 @@ impl Source {
}
}
impl From<super::Source> for Source {
fn from(src: super::Source) -> Self {
use super::Source::*;
match src {
Git(url) => Source {
source_type: SourceType::Git,
url,
},
Path(url) => Source {
source_type: SourceType::Path,
url,
},
Registry(url) => Source {
source_type: SourceType::Registry,
url,
},
}
}
}
#[derive(Debug, Diagnostic, Error)]
pub enum Error {
#[error(transparent)]