pub enum Compress {
Gzip,
Deflate,
Br,
Unknown,
}
Variants§
Implementations§
Source§impl Compress
impl Compress
Sourcepub fn from(header: &HttpHeaderMap) -> Self
pub fn from(header: &HttpHeaderMap) -> Self
Extracts the compression type from an HTTP header.
This function looks for the Content-Encoding
header in the provided Header
and attempts
to parse it into a Compress
enum value.
§Arguments
header
- The HTTP header from which the compression type is to be extracted.
§Returns
- The
Compress
value corresponding to theContent-Encoding
header, orCompress::Unknown
if the header does not match any known compression types.
Sourcepub fn decode(&self, data: &Vec<u8>, buffer_size: usize) -> Vec<u8>
pub fn decode(&self, data: &Vec<u8>, buffer_size: usize) -> Vec<u8>
Decodes data based on the compression type.
This function decodes the compressed data using the corresponding compression algorithm
(Gzip, Deflate, or Brotli) depending on the Compress
enum value.
§Arguments
data
- A vector of bytes containing the compressed data.buffer_size
- The buffer size to use during decompression.
§Returns
- A
Vec<u8>
containing the decompressed data.
Trait Implementations§
impl Eq for Compress
impl StructuralPartialEq for Compress
Auto Trait Implementations§
impl Freeze for Compress
impl RefUnwindSafe for Compress
impl Send for Compress
impl Sync for Compress
impl Unpin for Compress
impl UnwindSafe for Compress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more