mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Remove some unused pub use
exports (#3930)
This commit is contained in:
parent
a14fe2f6c7
commit
09f55482a0
5 changed files with 7 additions and 115 deletions
|
@ -1,8 +1,6 @@
|
||||||
pub use canonical_url::{CanonicalUrl, RepositoryUrl};
|
pub use canonical_url::{CanonicalUrl, RepositoryUrl};
|
||||||
pub use digest::digest;
|
pub use digest::digest;
|
||||||
pub use stable_hash::{StableHash, StableHasher};
|
|
||||||
|
|
||||||
mod cache_key;
|
mod cache_key;
|
||||||
mod canonical_url;
|
mod canonical_url;
|
||||||
mod digest;
|
mod digest;
|
||||||
mod stable_hash;
|
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
use std::hash::Hasher;
|
|
||||||
|
|
||||||
use seahash::SeaHasher;
|
|
||||||
|
|
||||||
/// A trait for types that can be hashed in a stable way across versions and platforms.
|
|
||||||
pub trait StableHash {
|
|
||||||
fn stable_hash(&self, state: &mut StableHasher);
|
|
||||||
|
|
||||||
fn stable_hash_slice(data: &[Self], state: &mut StableHasher)
|
|
||||||
where
|
|
||||||
Self: Sized,
|
|
||||||
{
|
|
||||||
for piece in data {
|
|
||||||
piece.stable_hash(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
|
||||||
pub struct StableHasher {
|
|
||||||
inner: SeaHasher,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl StableHasher {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
inner: SeaHasher::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn finish(self) -> u64 {
|
|
||||||
self.inner.finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hasher for StableHasher {
|
|
||||||
#[inline]
|
|
||||||
fn finish(&self) -> u64 {
|
|
||||||
self.inner.finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write(&mut self, bytes: &[u8]) {
|
|
||||||
self.inner.write(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_u8(&mut self, i: u8) {
|
|
||||||
self.inner.write_u8(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_u16(&mut self, i: u16) {
|
|
||||||
self.inner.write_u16(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_u32(&mut self, i: u32) {
|
|
||||||
self.inner.write_u32(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_u64(&mut self, i: u64) {
|
|
||||||
self.inner.write_u64(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_u128(&mut self, i: u128) {
|
|
||||||
self.inner.write_u128(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_usize(&mut self, i: usize) {
|
|
||||||
self.inner.write_usize(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_i8(&mut self, i: i8) {
|
|
||||||
self.inner.write_i8(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_i16(&mut self, i: i16) {
|
|
||||||
self.inner.write_i16(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_i32(&mut self, i: i32) {
|
|
||||||
self.inner.write_i32(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_i64(&mut self, i: i64) {
|
|
||||||
self.inner.write_i64(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_i128(&mut self, i: i128) {
|
|
||||||
self.inner.write_i128(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn write_isize(&mut self, i: isize) {
|
|
||||||
self.inner.write_isize(i);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,7 +32,8 @@ use uv_types::BuildContext;
|
||||||
|
|
||||||
use crate::archive::Archive;
|
use crate::archive::Archive;
|
||||||
use crate::locks::Locks;
|
use crate::locks::Locks;
|
||||||
use crate::{ArchiveMetadata, Error, LocalWheel, Reporter, SourceDistributionBuilder};
|
use crate::source::SourceDistributionBuilder;
|
||||||
|
use crate::{ArchiveMetadata, Error, LocalWheel, Reporter};
|
||||||
|
|
||||||
/// A cached high-level interface to convert distributions (a requirement resolved to a location)
|
/// A cached high-level interface to convert distributions (a requirement resolved to a location)
|
||||||
/// to a wheel or wheel metadata.
|
/// to a wheel or wheel metadata.
|
||||||
|
|
|
@ -6,7 +6,6 @@ pub use git::{git_url_to_precise, is_same_reference};
|
||||||
pub use index::{BuiltWheelIndex, RegistryWheelIndex};
|
pub use index::{BuiltWheelIndex, RegistryWheelIndex};
|
||||||
use pypi_types::{HashDigest, Metadata23};
|
use pypi_types::{HashDigest, Metadata23};
|
||||||
pub use reporter::Reporter;
|
pub use reporter::Reporter;
|
||||||
pub use source::SourceDistributionBuilder;
|
|
||||||
|
|
||||||
mod archive;
|
mod archive;
|
||||||
mod distribution_database;
|
mod distribution_database;
|
||||||
|
|
|
@ -45,7 +45,7 @@ mod built_wheel_metadata;
|
||||||
mod revision;
|
mod revision;
|
||||||
|
|
||||||
/// Fetch and build a source distribution from a remote source, or from a local cache.
|
/// Fetch and build a source distribution from a remote source, or from a local cache.
|
||||||
pub struct SourceDistributionBuilder<'a, T: BuildContext> {
|
pub(crate) struct SourceDistributionBuilder<'a, T: BuildContext> {
|
||||||
build_context: &'a T,
|
build_context: &'a T,
|
||||||
reporter: Option<Arc<dyn Reporter>>,
|
reporter: Option<Arc<dyn Reporter>>,
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ pub(crate) const METADATA: &str = "metadata.msgpack";
|
||||||
|
|
||||||
impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
||||||
/// Initialize a [`SourceDistributionBuilder`] from a [`BuildContext`].
|
/// Initialize a [`SourceDistributionBuilder`] from a [`BuildContext`].
|
||||||
pub fn new(build_context: &'a T) -> Self {
|
pub(crate) fn new(build_context: &'a T) -> Self {
|
||||||
Self {
|
Self {
|
||||||
build_context,
|
build_context,
|
||||||
reporter: None,
|
reporter: None,
|
||||||
|
@ -70,7 +70,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
||||||
|
|
||||||
/// Set the [`Reporter`] to use for this source distribution fetcher.
|
/// Set the [`Reporter`] to use for this source distribution fetcher.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn with_reporter(self, reporter: Arc<dyn Reporter>) -> Self {
|
pub(crate) fn with_reporter(self, reporter: Arc<dyn Reporter>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
reporter: Some(reporter),
|
reporter: Some(reporter),
|
||||||
..self
|
..self
|
||||||
|
@ -78,7 +78,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Download and build a [`SourceDist`].
|
/// Download and build a [`SourceDist`].
|
||||||
pub(super) async fn download_and_build(
|
pub(crate) async fn download_and_build(
|
||||||
&self,
|
&self,
|
||||||
source: &BuildableSource<'_>,
|
source: &BuildableSource<'_>,
|
||||||
tags: &Tags,
|
tags: &Tags,
|
||||||
|
@ -238,7 +238,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
||||||
/// Download a [`SourceDist`] and determine its metadata. This typically involves building the
|
/// Download a [`SourceDist`] and determine its metadata. This typically involves building the
|
||||||
/// source distribution into a wheel; however, some build backends support determining the
|
/// source distribution into a wheel; however, some build backends support determining the
|
||||||
/// metadata without building the source distribution.
|
/// metadata without building the source distribution.
|
||||||
pub(super) async fn download_and_build_metadata(
|
pub(crate) async fn download_and_build_metadata(
|
||||||
&self,
|
&self,
|
||||||
source: &BuildableSource<'_>,
|
source: &BuildableSource<'_>,
|
||||||
hashes: HashPolicy<'_>,
|
hashes: HashPolicy<'_>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue