Verify that bin_files exist in resolve stage (#382)

* Refactor: Extract new fn `BinFile::check_source_exists`
* Impl new async fn `AutoAbortJoinHandle::flattened_join`
* Impl new fn `Fetcher::fetcher_name`
* Verify that `bin_files` exist in `resolve` stage
   To ensure that the installation stage won't fail because of missing
   binaries.
* Rm unused `MultiFecther`
* Simplify `Future` impl for `AutoAbortJoinHandle`
* Add new variant `BinstallError::CargoTomlMissingPackage`
* Replace `unwrap` in `resolve_inner` with proper error handling
* Make `Fetcher::new` as a regular function
   instead of an `async` function.
* Ret `Arc<dyn Fetcher>` in trait fn `Fetcher::new`
* Refactor `resolve_inner`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-09-17 19:28:22 +10:00 committed by GitHub
parent 7ac55c46f1
commit fa79e7f105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 207 additions and 157 deletions

View file

@ -27,7 +27,7 @@ pub struct QuickInstall {
#[async_trait::async_trait]
impl super::Fetcher for QuickInstall {
async fn new(client: &Client, data: &Arc<Data>) -> Arc<Self> {
fn new(client: &Client, data: &Arc<Data>) -> Arc<dyn super::Fetcher> {
let crate_name = &data.name;
let version = &data.version;
let target = data.target.clone();
@ -68,6 +68,10 @@ impl super::Fetcher for QuickInstall {
CompactString::from("QuickInstall")
}
fn fetcher_name(&self) -> &'static str {
"QuickInstall"
}
fn is_third_party(&self) -> bool {
true
}