Remove unused read_from_zip function
This commit is contained in:
@@ -132,35 +132,4 @@ impl<T: bytemuck::Pod + Send + Sync + 'static> DataServer<T> {
|
||||
);
|
||||
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?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user