[][src]Function pubgrub::solver::choose_package_with_fewest_versions

pub fn choose_package_with_fewest_versions<P: Package, V: Version, T, U, I, F>(
    list_available_versions: F,
    potential_packages: impl Iterator<Item = (T, U)>
) -> (T, Option<V>) where
    T: Borrow<P>,
    U: Borrow<Range<V>>,
    I: Iterator<Item = V>,
    F: Fn(&P) -> I, 

This is a helper function to make it easy to implement DependencyProvider::choose_package_version. It takes a function list_available_versions that takes a package and returns an iterator of the available versions in preference order. The helper finds the package from the packages argument with the fewest versions from list_available_versions contained in the constraints. Then takes that package and finds the first version contained in the constraints.