From 7ce974b4f908b874b1f63570b6f3f0aaa3eab264 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Wed, 14 Jul 2021 13:32:00 -0400 Subject: [PATCH] Make EncryptedDiskReader generic over R --- src/cache/fs.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cache/fs.rs b/src/cache/fs.rs index 10bf6b4..ba6ba72 100644 --- a/src/cache/fs.rs +++ b/src/cache/fs.rs @@ -138,13 +138,13 @@ async fn read_file( } } -struct EncryptedDiskReader { - file: Pin>, +struct EncryptedDiskReader { + file: Pin>, keystream: XChaCha20, } -impl EncryptedDiskReader { - fn new(file: File, nonce: &XNonce, key: &Key) -> Self { +impl EncryptedDiskReader { + fn new(file: R, nonce: &XNonce, key: &Key) -> Self { Self { file: Box::pin(file), keystream: XChaCha20::new(key, nonce), @@ -165,7 +165,7 @@ impl MetadataFetch for R { } } -impl AsyncRead for EncryptedDiskReader { +impl AsyncRead for EncryptedDiskReader { fn poll_read( mut self: Pin<&mut Self>, cx: &mut Context<'_>,