Impl binstall_v1::Source::cratesio_registry

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-27 19:23:15 +10:00
parent cc13aa911f
commit 1a8fda1f5e
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
use thiserror::Error;
use url::Url;
use crate::{cargo_home, FileLock};
use crate::{cargo_home, cratesio_url, FileLock};
#[derive(Debug, Serialize, Deserialize)]
pub struct MetaData {
@ -61,6 +61,15 @@ pub struct Source {
url: Url,
}
impl Source {
pub fn cratesio_registry() -> Source {
Self {
source_type: SourceType::Registry,
url: cratesio_url().clone(),
}
}
}
impl From<super::Source> for Source {
fn from(src: super::Source) -> Self {
use super::Source::*;