mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-29 16:13:47 +00:00
uv-pypi-types: make room for group names in addition to extras
This adds support for providing conflicting group names in addition to extra names to `Conflicts`. This merely makes "room" for it in the types while keeping everything working. We'll add proper support for it in the next commit. Note that one interesting trick we do here is depend directly on `hashbrown` so that we can make use of its `Equivalent` trait. This in turn lets us use things like `ConflictItemRef` as a lookup key for a hashset that contains `ConflictItem`. This mirrors using a `&str` as a lookup key for a hashset that contains `String`, but works for arbitrary types. `std` doesn't support this, but `hashbrown` does. This trick in turn lets us simplify some of our data structures. This also rejiggers some of the serde-interaction with the conflicting types. We now use a wire type to represent our conflicting items for more flexibility. i.e., Support `extra` XOR `group` fields.
This commit is contained in:
parent
cda8b3276a
commit
06943ca870
11 changed files with 315 additions and 63 deletions
|
@ -25,6 +25,13 @@ pub use resolver::{
|
|||
pub use version_map::VersionMap;
|
||||
pub use yanks::AllowedYanks;
|
||||
|
||||
/// A custom `HashSet` using `hashbrown`.
|
||||
///
|
||||
/// We use `hashbrown` instead of `std` to get access to its `Equivalent`
|
||||
/// trait. This lets use store things like `ConflictItem`, but refer to it via
|
||||
/// `ConflictItemRef`. i.e., We can avoid allocs on lookups.
|
||||
type FxHashbrownSet<T> = hashbrown::HashSet<T, rustc_hash::FxBuildHasher>;
|
||||
|
||||
mod bare;
|
||||
mod candidate_selector;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue