feat: add byte conversion to gzip file

This commit is contained in:
leonhard committed 2026-10-23 13:11:05 +02:00
1 parent 3ef19612d7
commit 3904f4bb40
1 file changed
+14
+14
View File
@@ -3,4 +3,18 @@ mod header;
struct GzipFile { struct GzipFile {
header: header::Header, header: header::Header,
compressed_data: Vec<u8>,
crc32: u32,
input_size: u32,
}
impl From<GzipFile> for Vec<u8> {
fn from(mut gzip_file: GzipFile) -> Self {
let mut result = Vec::new();
result.append(&mut gzip_file.header.into());
result.append(&mut gzip_file.compressed_data);
result.extend(gzip_file.crc32.to_le_bytes());
result.extend(gzip_file.input_size.to_le_bytes());
result
}
} }