Make EncryptedDiskReader generic over R
This commit is contained in:
parent
973ece3604
commit
7ce974b4f9
1 changed files with 5 additions and 5 deletions
10
src/cache/fs.rs
vendored
10
src/cache/fs.rs
vendored
|
@ -138,13 +138,13 @@ async fn read_file(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EncryptedDiskReader {
|
struct EncryptedDiskReader<R> {
|
||||||
file: Pin<Box<File>>,
|
file: Pin<Box<R>>,
|
||||||
keystream: XChaCha20,
|
keystream: XChaCha20,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EncryptedDiskReader {
|
impl<R> EncryptedDiskReader<R> {
|
||||||
fn new(file: File, nonce: &XNonce, key: &Key) -> Self {
|
fn new(file: R, nonce: &XNonce, key: &Key) -> Self {
|
||||||
Self {
|
Self {
|
||||||
file: Box::pin(file),
|
file: Box::pin(file),
|
||||||
keystream: XChaCha20::new(key, nonce),
|
keystream: XChaCha20::new(key, nonce),
|
||||||
|
@ -165,7 +165,7 @@ impl<R: AsyncBufRead + Send> MetadataFetch for R {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsyncRead for EncryptedDiskReader {
|
impl<R: AsyncRead> AsyncRead for EncryptedDiskReader<R> {
|
||||||
fn poll_read(
|
fn poll_read(
|
||||||
mut self: Pin<&mut Self>,
|
mut self: Pin<&mut Self>,
|
||||||
cx: &mut Context<'_>,
|
cx: &mut Context<'_>,
|
||||||
|
|
Loading…
Reference in a new issue