From 1a8fda1f5ebe1e48f5b3365f4e8cb1ee7fec2fd2 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Wed, 27 Jul 2022 19:23:15 +1000 Subject: [PATCH] Impl `binstall_v1::Source::cratesio_registry` Signed-off-by: Jiahao XU --- src/metafiles/binstall_v1.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/metafiles/binstall_v1.rs b/src/metafiles/binstall_v1.rs index 9704719f..4ba95dae 100644 --- a/src/metafiles/binstall_v1.rs +++ b/src/metafiles/binstall_v1.rs @@ -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 for Source { fn from(src: super::Source) -> Self { use super::Source::*;