mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-08 13:10:03 +00:00
Refactor: Use binstall_v1::MetaData
in mod binstall
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
05c0d5fcae
commit
2f27a5fd93
6 changed files with 51 additions and 82 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue