Refactor candidate selector for batch prefetching (#2832)

Batch prefetching needs more information from the candidate selector, so
i've split `select` into methods. Split out from #2452. No functional
changes.
This commit is contained in:
konsti 2024-04-05 16:51:01 +02:00 committed by GitHub
parent a0b8d1a994
commit 5474c61fed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 70 additions and 38 deletions

View file

@ -152,7 +152,9 @@ impl VersionMap {
/// which can be used to lazily request a [`CompatibleDist`]. This is
/// useful in cases where one can skip materializing a full distribution
/// for each version.
pub(crate) fn iter(&self) -> impl DoubleEndedIterator<Item = (&Version, VersionMapDistHandle)> {
pub(crate) fn iter(
&self,
) -> impl DoubleEndedIterator<Item = (&Version, VersionMapDistHandle)> + ExactSizeIterator {
match self.inner {
VersionMapInner::Eager(ref map) => {
either::Either::Left(map.iter().map(|(version, dist)| {