uv/crates/pypi-types/src
Charlie Marsh 13ae5ac8dc
Replace PyPI-internal Hashes representation with flat vector (#2925)
## Summary

Right now, we have a `Hashes` representation that looks like:

```rust
/// A dictionary mapping a hash name to a hex encoded digest of the file.
///
/// PEP 691 says multiple hashes can be included and the interpretation is left to the client.
#[derive(Debug, Clone, Eq, PartialEq, Default, Deserialize)]
pub struct Hashes {
    pub md5: Option<Box<str>>,
    pub sha256: Option<Box<str>>,
    pub sha384: Option<Box<str>>,
    pub sha512: Option<Box<str>>,
}
```

It stems from the PyPI API, which returns a dictionary of hashes.

We tend to pass these around as a vector of `Vec<Hashes>`. But it's a
bit strange because each entry in that vector could contain multiple
hashes. And it makes it difficult to ask questions like "Is
`sha256:ab21378ca980a8` in the set of hashes"?

This PR instead treats `Hashes` as the PyPI-internal type, and uses a
new `Vec<HashDigest>` everywhere in our own APIs.
2024-04-09 16:56:16 +00:00
..
base_url.rs Use scheme parsing to determine absolute vs. relative URLs (#2904) 2024-04-08 17:04:27 -04:00
direct_url.rs Clippy pedantic (#1963) 2024-02-25 14:04:05 -05:00
lenient_requirement.rs Re-test validity after every lenient parsing change (#2550) 2024-03-19 15:41:49 -04:00
lib.rs Use simpler pip-like `Scheme` for install paths (#2173) 2024-03-04 15:50:13 -05:00
metadata.rs Clean up `Error` enum in `Metadata23` (#2835) 2024-04-05 14:40:33 +00:00
scheme.rs Query interpreter to determine correct `virtualenv` paths (#2188) 2024-03-05 16:13:24 -05:00
simple_json.rs Replace PyPI-internal Hashes representation with flat vector (#2925) 2024-04-09 16:56:16 +00:00