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 {
|
||||
file: Pin<Box<File>>,
|
||||
struct EncryptedDiskReader<R> {
|
||||
file: Pin<Box<R>>,
|
||||
keystream: XChaCha20,
|
||||
}
|
||||
|
||||
impl EncryptedDiskReader {
|
||||
fn new(file: File, nonce: &XNonce, key: &Key) -> Self {
|
||||
impl<R> EncryptedDiskReader<R> {
|
||||
fn new(file: R, nonce: &XNonce, key: &Key) -> Self {
|
||||
Self {
|
||||
file: Box::pin(file),
|
||||
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(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
|
|
Loading…
Reference in a new issue