Remove unused read_from_zip function

This commit is contained in:
Michael Schimmel
2026-02-16 18:17:17 +01:00
parent c8f561749d
commit a52190391a
-31
View File
@@ -132,35 +132,4 @@ impl<T: bytemuck::Pod + Send + Sync + 'static> DataServer<T> {
); );
Ok(shared_data) Ok(shared_data)
} }
// async fn read_from_zip - removed as it was unused in main.rs context or seemingly redundant/internal helper not used in extracted public interface?
// Checking main.rs: It was NOT used in main.rs, it was a private helper method inside impl DataServer.
// However, it wasn't used by load_data either. It seems dead code or future code.
// I will include it to be safe, but make it private or allow dead code if it warns.
// Actually, looking at main.rs again, read_from_zip was defined but NOT used in the provided snippet of DataServer.
// Wait, load_data implements similar logic inline.
// I will keep it to strictly follow "never change code unless..." (preserving the code structure).
#[allow(dead_code)]
async fn read_from_zip<R: bytemuck::Pod + Send + 'static>(
&self,
path: &Path,
) -> anyhow::Result<Vec<R>> {
let path = path.to_path_buf();
tokio::task::spawn_blocking(move || {
let file = std::fs::File::open(&path)?;
let mut archive = ZipArchive::new(file)?;
for i in 0..archive.len() {
let mut file = archive.by_index(i)?;
if file.name().ends_with(".bin") {
let mut bin_content = vec![0u8; file.size() as usize];
file.read_exact(&mut bin_content)?;
let records: &[R] = cast_slice(&bin_content);
return Ok(records.to_vec());
}
}
Err(anyhow::anyhow!("No .bin file found"))
})
.await?
}
} }