Optimization: Box variants in Error to reduce size and remove unused variants in BinstallError (#530)

* Box `HttpError` in `binsalk_downloader::remote::Error::Http`
   as `HttpError` contains `Url` which are too big.
* Box `HttpError` in `BinstallError::Http` same as the previous commit.
* Box `TinyTemplateError` in `BinstallError::Template`
  since `TinyTemplateError` is 56 bytes large where most of the other variants are below 40 bytes large.
* Rm unsed variant `BinstallError::VersionUnavailable`
* Box `CratesIoApiError` in `BinstallError::CratesIoApi`
   It is 32 bytes large while other variants are below 40 bytes large.
* Improve err msg for `BinstallError::CrateContext`
* Rm unused variant `BinstallError::VersionReq`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-11-15 00:46:32 +11:00 committed by GitHub
parent 933c6425ef
commit c34a2850b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 37 deletions

View file

@ -38,7 +38,7 @@ pub async fn fetch_crate_cratesio(
.await
.map_err(|err| BinstallError::CratesIoApi {
crate_name: name.into(),
err,
err: Box::new(err),
})?;
// Locate matching version