feat: add byte conversion to gzip file
This commit is contained in:
1 parent
3ef19612d7
commit
61a8758082
1 file changed
+15
-1
+15
-1
@@ -1,6 +1,20 @@
|
|||||||
mod crc32;
|
mod crc32;
|
||||||
mod header;
|
mod header;
|
||||||
|
|
||||||
struct GzipFile {
|
pub 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user