/// Make sure that a given package is on disk, downloading it if it is not
/// already locally available.
Make sure that a given package is on disk, downloading it if it is not
already locally available.
Make sure that a given package is on disk downloading it if it is not already locally available .
pub async fn ensure_package_on_disk<D, P, A>(log: Logger, dl: D, pkgext: P) -> Result<A>
where
    D: PackageDownloader,
    P: PackageExt<Artifact = A>,
{
    if let Some(artifacts) = pkgext.on_disk() {
        return Ok(artifacts);
    }
    let pkg: packages::generic::Package = pkgext.clone().into();
    ensure_package_on_disk_ignoring_artifacts(log, dl, &pkg).await?;
    pkgext
        .on_disk()
        .context("package supposedly downloaded but was not on disk")
        .map_err(|error| Error::Install {
            error,
            package: pkg,
        })
}
pub async fn ensure_package_on_disk < D , P , A > ( log : Logger , dl : D , pkgext : P ) -> Result < A > where D : PackageDownloader , P : PackageExt < Artifact = A > , { if let Some ( artifacts ) = pkgext . on_disk ( ) { return Ok ( artifacts ) ; } let pkg : packages :: generic :: Package = pkgext . clone ( ) . into ( ) ; ensure_package_on_disk_ignoring_artifacts ( log , dl , & pkg ) . await ? ; pkgext . on_disk ( ) . context ( " " ) . map_err ( | error | Error :: Install { error , package : pkg , } ) }
Make sure that a given package is on disk, downloading it if it is not
already locally available.
Make sure that a given package is on disk downloading it if it is not already locally available .
log
Logger
dl
D
pkgext
P