You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pass an iterator to add_incompatibility_from_dependencies (#226)
* Relax dependencies to iterator instead of a hashmap to avoid clones
Previously, `Dependencies::Available` was hardcoded to a hash map. By relaxing this to `impl IntoIterator<_> + Clone`, we avoid converting from uv's ordered `Vec<(_, _)>` to a `HashMap<_, _>` and avoid cloning.
## Design considerations
We implement this using the return type `Dependencies<impl IntoIterator<Item = (DP::P, DP::VS)> + Clone, DP::M>`. This allows using `get_dependencies` without knowing the actual (which a generic bound would require) or adding another associated type to the dependency provider. The `impl` bound also captures all input lifetimes, keeping `p` and `v` borrowed. We could bind the iterator to only `&self` instead, but this would only move two clones (package and version) to the implementer.
Co-authored-by: Jacob Finkelman <[email protected]>
Co-authored-by: Zanie <[email protected]>
Co-authored-by: Charlie Marsh <[email protected]>
* Avoid clone
* Don't change `DependencyProvider`
* Avoid changing the public API for the dependencies internal iterator
---------
Co-authored-by: Jacob Finkelman <[email protected]>
Co-authored-by: Zanie <[email protected]>
Co-authored-by: Charlie Marsh <[email protected]>
0 commit comments