Skip to content

Commit

Permalink
Remove dead Sha256Reader (#7929)
Browse files Browse the repository at this point in the history
It seems that this code is never used.
  • Loading branch information
konstin authored Oct 4, 2024
1 parent 247f662 commit 79555f3
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions crates/uv-extract/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,6 @@ use tokio::io::{AsyncReadExt, ReadBuf};

use uv_pypi_types::{HashAlgorithm, HashDigest};

pub struct Sha256Reader<'a, R> {
reader: R,
hasher: &'a mut sha2::Sha256,
}

impl<'a, R> Sha256Reader<'a, R>
where
R: tokio::io::AsyncRead + Unpin,
{
pub fn new(reader: R, hasher: &'a mut sha2::Sha256) -> Self {
Sha256Reader { reader, hasher }
}
}

impl<'a, R> tokio::io::AsyncRead for Sha256Reader<'a, R>
where
R: tokio::io::AsyncRead + Unpin,
{
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &mut ReadBuf<'_>,
) -> Poll<std::io::Result<()>> {
let reader = Pin::new(&mut self.reader);
match reader.poll_read(cx, buf) {
Poll::Ready(Ok(())) => {
self.hasher.update(buf.filled());
Poll::Ready(Ok(()))
}
other => other,
}
}
}

#[derive(Debug)]
pub enum Hasher {
Md5(md5::Md5),
Expand Down

0 comments on commit 79555f3

Please sign in to comment.