feat: zip file reading

This commit is contained in:
DecDuck
2025-07-02 11:55:04 +10:00
parent c1aaf8adcd
commit 48e5b97a4e
8 changed files with 163 additions and 42 deletions

View File

@ -1,4 +1,6 @@
use std::io::{Read, Seek, SeekFrom};
use std::{
fmt::Debug, io::{Read, Seek, SeekFrom}
};
use tokio::io::{self, AsyncRead};
@ -26,6 +28,7 @@ impl<T: Read + Send + Seek> MinimumFileObject for T {}
// Intentionally not a generic, because of types in read_file
pub struct ReadToAsyncRead {
pub inner: Box<(dyn Read + Send)>,
pub backend: Box<(dyn VersionBackend + Send)>,
}
impl AsyncRead for ReadToAsyncRead {
@ -35,7 +38,8 @@ impl AsyncRead for ReadToAsyncRead {
buf: &mut tokio::io::ReadBuf<'_>,
) -> std::task::Poll<io::Result<()>> {
let mut read_buf = [0u8; 8192];
let amount = self.inner.read(&mut read_buf).unwrap();
let var_name = self.inner.read(&mut read_buf).unwrap();
let amount = var_name;
buf.put_slice(&read_buf[0..amount]);
std::task::Poll::Ready(Ok(()))
}