Merge branch 'main' into feature/bin-multi-targets

This commit is contained in:
Jiahao XU 2022-06-07 16:38:14 +10:00 committed by GitHub
commit 6f7c8fa8ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 30 deletions
src/fetchers

View file

@ -1,4 +1,5 @@
use std::path::Path;
use std::sync::Arc;
use log::{debug, info, warn};
use reqwest::Method;
@ -22,8 +23,8 @@ impl GhCrateMeta {
#[async_trait::async_trait]
impl super::Fetcher for GhCrateMeta {
async fn new(data: &Data) -> Box<Self> {
Box::new(Self { data: data.clone() })
async fn new(data: &Data) -> Arc<Self> {
Arc::new(Self { data: data.clone() })
}
async fn check(&self) -> Result<bool, BinstallError> {
@ -36,7 +37,7 @@ impl super::Fetcher for GhCrateMeta {
}
info!("Checking for package at: '{url}'");
remote_exists(url.as_str(), Method::HEAD).await
remote_exists(url, Method::HEAD).await
}
async fn fetch(&self, dst: &Path) -> Result<(), BinstallError> {