fn installed_exact_package<T>(
    dep: Dependency,
    source: &mut T,
    config: &Config,
    opts: &ops::CompileOptions,
    root: &Filesystem,
    dst: &Path,
    force: bool,
) -> CargoResult<Option<Package>>
where
    T: Source,
{
    if !dep.version_req().is_exact() {
        // If the version isn't exact, we may need to update the registry and look for a newer
        // version - we can't know if the package is installed without doing so.
        return Ok(None);
    }
    // Try getting the package from the registry  without updating it, to avoid a potentially
    // expensive network call in the case that the package is already installed.
    // If this fails, the caller will possibly do an index update and try again, this is just a
    // best-effort check to see if we can avoid hitting the network.
    if let Ok(pkg) = select_dep_pkg(source, dep, config, false) {
        let (_ws, rustc, target) =
            make_ws_rustc_target(config, opts, &source.source_id(), pkg.clone())?;
        if let Ok(true) = is_installed(&pkg, config, opts, &rustc, &target, root, dst, force) {
            return Ok(Some(pkg));
        }
    }
    Ok(None)
}
/// Checks if vers can only be satisfied by exactly one version of a package in a registry, and it's
/// already installed. If this is the case, we can skip interacting with a registry to check if
/// newer versions may be installable, as no newer version can exist.
Checks if vers can only be satisfied by exactly one version of a package in a registry, and it's
already installed. If this is the case, we can skip interacting with a registry to check if
newer versions may be installable, as no newer version can exist.
Checks if vers can only be satisfied by exactly one version of a package in a registry and it ' s already installed . If this is the case we can skip interacting with a registry to check if newer versions may be installable as no newer version can exist .
fn installed_exact_package<T>(
    dep: Dependency,
    source: &mut T,
    config: &Config,
    opts: &ops::CompileOptions,
    root: &Filesystem,
    dst: &Path,
    force: bool,
) -> CargoResult<Option<Package>>
where
    T: Source,
{
    if !dep.version_req().is_exact() {
        // If the version isn't exact, we may need to update the registry and look for a newer
        // version - we can't know if the package is installed without doing so.
        return Ok(None);
    }
    // Try getting the package from the registry  without updating it, to avoid a potentially
    // expensive network call in the case that the package is already installed.
    // If this fails, the caller will possibly do an index update and try again, this is just a
    // best-effort check to see if we can avoid hitting the network.
    if let Ok(pkg) = select_dep_pkg(source, dep, config, false) {
        let (_ws, rustc, target) =
            make_ws_rustc_target(config, opts, &source.source_id(), pkg.clone())?;
        if let Ok(true) = is_installed(&pkg, config, opts, &rustc, &target, root, dst, force) {
            return Ok(Some(pkg));
        }
    }
    Ok(None)
}
fn installed_exact_package < T > ( dep : Dependency , source : & mut T , config : & Config , opts : & ops :: CompileOptions , root : & Filesystem , dst : & Path , force : bool , ) -> CargoResult < Option < Package > > where T : Source , { if ! dep . version_req ( ) . is_exact ( ) { // If the version isn't exact, we may need to update the registry and look for a newer // version - we can't know if the package is installed without doing so. return Ok ( None ) ; } // Try getting the package from the registry  without updating it, to avoid a potentially // expensive network call in the case that the package is already installed. // If this fails, the caller will possibly do an index update and try again, this is just a // best-effort check to see if we can avoid hitting the network. if let Ok ( pkg ) = select_dep_pkg ( source , dep , config , false ) { let ( _ws , rustc , target ) = make_ws_rustc_target ( config , opts , & source . source_id ( ) , pkg . clone ( ) ) ? ; if let Ok ( true ) = is_installed ( & pkg , config , opts , & rustc , & target , root , dst , force ) { return Ok ( Some ( pkg ) ) ; } } Ok ( None ) }
Checks if vers can only be satisfied by exactly one version of a package in a registry, and it's
already installed.
Checks if vers can only be satisfied by exactly one version of a package in a registry and it ' s already installed .
dep
Dependency
source
&mut T
config
&Config
opts
&ops::CompileOptions
root
&Filesystem
dst
&Path
force
bool
dep
Dependency
source
&mut T
config
&Config
opts
&ops::CompileOptions
root
&Filesystem
dst
&Path
force
bool