mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-25 23:00:03 +00:00
Refactor: Rm global var helpers::CLIENT
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
3c06c45792
commit
fa63dbe5cf
6 changed files with 42 additions and 36 deletions
|
@ -4,6 +4,7 @@ use std::time::Duration;
|
|||
use cargo_toml::Manifest;
|
||||
use crates_io_api::AsyncClient;
|
||||
use log::debug;
|
||||
use reqwest::Client;
|
||||
use url::Url;
|
||||
|
||||
use super::find_version;
|
||||
|
@ -16,6 +17,7 @@ use visitor::ManifestVisitor;
|
|||
|
||||
/// Fetch a crate Cargo.toml by name and version from crates.io
|
||||
pub async fn fetch_crate_cratesio(
|
||||
client: &Client,
|
||||
name: &str,
|
||||
version_req: &str,
|
||||
) -> Result<Manifest<Meta>, BinstallError> {
|
||||
|
@ -67,6 +69,7 @@ pub async fn fetch_crate_cratesio(
|
|||
let manifest_dir_path: PathBuf = format!("{name}-{version_name}").into();
|
||||
|
||||
download_tar_based_and_visit(
|
||||
client,
|
||||
Url::parse(&crate_url)?,
|
||||
TarBasedFmt::Tgz,
|
||||
ManifestVisitor::new(manifest_dir_path),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue