Add convenience methods to Manifest to iterate over requirements (#2701)

## Summary

These are repeated a bunch. It's nice to DRY them up and ensure the
ordering is consistent.
This commit is contained in:
Charlie Marsh 2024-03-27 21:03:44 -04:00 committed by GitHub
parent b6ab919945
commit 4cc91cc6bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 168 additions and 92 deletions

View file

@ -136,10 +136,10 @@ impl VersionMap {
/// stored in this map. For example, the versions `1.2.0` and `1.2` are
/// semantically equivalent, but when converted to strings, they are
/// distinct.
pub(crate) fn get_with_version<'a>(
&'a self,
pub(crate) fn get_with_version(
&self,
version: &Version,
) -> Option<(&'a Version, &'a PrioritizedDist)> {
) -> Option<(&Version, &PrioritizedDist)> {
match self.inner {
VersionMapInner::Eager(ref map) => map.get_key_value(version),
VersionMapInner::Lazy(ref lazy) => lazy.get_with_version(version),