niffler_temp/seek/
compression.rs

1/* standard use */
2use std::io;
3
4/* Some trait definition */
5pub trait ReadSeek: io::Read + io::Seek {}
6
7impl<T> ReadSeek for T where T: io::Read + io::Seek {}
8
9pub trait WriteSeek: io::Write + io::Seek {}
10
11impl<T> WriteSeek for T where T: io::Write + io::Seek {}
12
13/// `Format` represent a compression format of a file. Currently BGzip are supported.
14#[derive(Debug, PartialEq, Eq, Clone, Copy)]
15pub enum Format {
16    BGzip,
17    No,
18}
19
20pub(crate) fn bytes2type(bytes: [u8; 17]) -> Format {
21    match bytes {
22        [0x1F, 0x8B, 0x8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xFF, 0x6, 0x0, 0x42, 0x43, 0x2, 0x0, 0x0] => {
23            Format::BGzip
24        }
25        _ => Format::No,
26    }
27}